Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: components/proximity_auth/cryptauth/cryptauth_device_manager.cc

Issue 1248533003: Hook up CryptAuthGCMManager to the enrollment and device sync managers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webui Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/cryptauth/cryptauth_device_manager.cc
diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager.cc b/components/proximity_auth/cryptauth/cryptauth_device_manager.cc
index 396d1915fd1939c457a30c029e9c3520e12d230d..3e641bbc96c31a01d3ff92cbea28cb59553ea1fc 100644
--- a/components/proximity_auth/cryptauth/cryptauth_device_manager.cc
+++ b/components/proximity_auth/cryptauth/cryptauth_device_manager.cc
@@ -88,14 +88,16 @@ bool DictionaryToUnlockKey(const base::DictionaryValue& dictionary,
CryptAuthDeviceManager::CryptAuthDeviceManager(
scoped_ptr<base::Clock> clock,
scoped_ptr<CryptAuthClientFactory> client_factory,
+ CryptAuthGCMManager* gcm_manager,
PrefService* pref_service)
: clock_(clock.Pass()),
client_factory_(client_factory.Pass()),
+ gcm_manager_(gcm_manager),
pref_service_(pref_service),
- weak_ptr_factory_(this) {
-}
+ weak_ptr_factory_(this) {}
CryptAuthDeviceManager::~CryptAuthDeviceManager() {
+ gcm_manager_->RemoveObserver(this);
}
// static
@@ -112,6 +114,8 @@ void CryptAuthDeviceManager::RegisterPrefs(PrefRegistrySimple* registry) {
void CryptAuthDeviceManager::Start() {
UpdateUnlockKeysFromPrefs();
+ gcm_manager_->AddObserver(this);
+
base::Time last_successful_sync = GetLastSyncTime();
base::TimeDelta elapsed_time_since_last_sync =
clock_->Now() - last_successful_sync;
@@ -216,6 +220,10 @@ scoped_ptr<SyncScheduler> CryptAuthDeviceManager::CreateSyncScheduler() {
kDeviceSyncMaxJitterRatio, "CryptAuth DeviceSync"));
}
+void CryptAuthDeviceManager::OnResyncMessage() {
+ ForceSyncNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED);
+}
+
void CryptAuthDeviceManager::UpdateUnlockKeysFromPrefs() {
const base::ListValue* unlock_key_list =
pref_service_->GetList(prefs::kCryptAuthDeviceSyncUnlockKeys);

Powered by Google App Engine
This is Rietveld 408576698