forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfake_cryptauth_gcm_manager.cc
53 lines (40 loc) · 1.49 KB
/
fake_cryptauth_gcm_manager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/cryptauth/fake_cryptauth_gcm_manager.h"
namespace cryptauth {
FakeCryptAuthGCMManager::FakeCryptAuthGCMManager(
const std::string& registration_id)
: registration_in_progress_(false), registration_id_(registration_id) {}
FakeCryptAuthGCMManager::~FakeCryptAuthGCMManager() {}
void FakeCryptAuthGCMManager::StartListening() {}
void FakeCryptAuthGCMManager::RegisterWithGCM() {
registration_in_progress_ = true;
}
std::string FakeCryptAuthGCMManager::GetRegistrationId() {
return registration_id_;
}
void FakeCryptAuthGCMManager::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
void FakeCryptAuthGCMManager::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
void FakeCryptAuthGCMManager::CompleteRegistration(
const std::string& registration_id) {
DCHECK(registration_in_progress_);
registration_in_progress_ = false;
registration_id_ = registration_id;
bool success = !registration_id_.empty();
for (auto& observer : observers_)
observer.OnGCMRegistrationResult(success);
}
void FakeCryptAuthGCMManager::PushReenrollMessage() {
for (auto& observer : observers_)
observer.OnReenrollMessage();
}
void FakeCryptAuthGCMManager::PushResyncMessage() {
for (auto& observer : observers_)
observer.OnResyncMessage();
}
} // namespace cryptauth