diff options
author | tengs <tengs@chromium.org> | 2015-07-28 09:52:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-28 16:52:48 +0000 |
commit | 757fd84c95ee5a34252150bc3ffe8ec415f285c2 (patch) | |
tree | 4b5d6d5593ae9b5bf29e8b38a6c5f16cd528a964 /components/proximity_auth/cryptauth/cryptauth_device_manager.cc | |
parent | b3d575b166091d2a3e948520d3ca30de090ca7a7 (diff) | |
download | chromium_src-757fd84c95ee5a34252150bc3ffe8ec415f285c2.zip chromium_src-757fd84c95ee5a34252150bc3ffe8ec415f285c2.tar.gz chromium_src-757fd84c95ee5a34252150bc3ffe8ec415f285c2.tar.bz2 |
Hook up CryptAuthGCMManager to the enrollment and device sync managers.
CryptAuth enrollment now performs a GCM registration if no previous registration
has been completed. GCM push messages can now trigger enrollment and device sync
attempts.
BUG=512230
TEST=unit tests
Review URL: https://codereview.chromium.org/1248533003
Cr-Commit-Position: refs/heads/master@{#340704}
Diffstat (limited to 'components/proximity_auth/cryptauth/cryptauth_device_manager.cc')
-rw-r--r-- | components/proximity_auth/cryptauth/cryptauth_device_manager.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager.cc b/components/proximity_auth/cryptauth/cryptauth_device_manager.cc index 396d191..3e641bb 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); |