| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" | 5 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 true); | 228 true); |
| 229 sync_request_->OnDidComplete(false); | 229 sync_request_->OnDidComplete(false); |
| 230 cryptauth_client_.reset(); | 230 cryptauth_client_.reset(); |
| 231 sync_request_.reset(); | 231 sync_request_.reset(); |
| 232 FOR_EACH_OBSERVER( | 232 FOR_EACH_OBSERVER( |
| 233 Observer, observers_, | 233 Observer, observers_, |
| 234 OnSyncFinished(SyncResult::FAILURE, DeviceChangeResult::UNCHANGED)); | 234 OnSyncFinished(SyncResult::FAILURE, DeviceChangeResult::UNCHANGED)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 std::unique_ptr<SyncScheduler> CryptAuthDeviceManager::CreateSyncScheduler() { | 237 std::unique_ptr<SyncScheduler> CryptAuthDeviceManager::CreateSyncScheduler() { |
| 238 return base::WrapUnique(new SyncSchedulerImpl( | 238 return base::MakeUnique<SyncSchedulerImpl>( |
| 239 this, base::TimeDelta::FromHours(kRefreshPeriodHours), | 239 this, base::TimeDelta::FromHours(kRefreshPeriodHours), |
| 240 base::TimeDelta::FromMinutes(kDeviceSyncBaseRecoveryPeriodMinutes), | 240 base::TimeDelta::FromMinutes(kDeviceSyncBaseRecoveryPeriodMinutes), |
| 241 kDeviceSyncMaxJitterRatio, "CryptAuth DeviceSync")); | 241 kDeviceSyncMaxJitterRatio, "CryptAuth DeviceSync"); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CryptAuthDeviceManager::OnResyncMessage() { | 244 void CryptAuthDeviceManager::OnResyncMessage() { |
| 245 ForceSyncNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED); | 245 ForceSyncNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void CryptAuthDeviceManager::UpdateUnlockKeysFromPrefs() { | 248 void CryptAuthDeviceManager::UpdateUnlockKeysFromPrefs() { |
| 249 const base::ListValue* unlock_key_list = | 249 const base::ListValue* unlock_key_list = |
| 250 pref_service_->GetList(prefs::kCryptAuthDeviceSyncUnlockKeys); | 250 pref_service_->GetList(prefs::kCryptAuthDeviceSyncUnlockKeys); |
| 251 unlock_keys_.clear(); | 251 unlock_keys_.clear(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 request.set_invocation_reason(invocation_reason); | 301 request.set_invocation_reason(invocation_reason); |
| 302 request.set_allow_stale_read(is_sync_speculative); | 302 request.set_allow_stale_read(is_sync_speculative); |
| 303 cryptauth_client_->GetMyDevices( | 303 cryptauth_client_->GetMyDevices( |
| 304 request, base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesSuccess, | 304 request, base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesSuccess, |
| 305 weak_ptr_factory_.GetWeakPtr()), | 305 weak_ptr_factory_.GetWeakPtr()), |
| 306 base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesFailure, | 306 base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesFailure, |
| 307 weak_ptr_factory_.GetWeakPtr())); | 307 weak_ptr_factory_.GetWeakPtr())); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace proximity_auth | 310 } // namespace proximity_auth |
| OLD | NEW |