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/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 |
11 #include "base/base64url.h" | 11 #include "base/base64url.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "components/cryptauth/cryptauth_client.h" |
| 14 #include "components/cryptauth/pref_names.h" |
| 15 #include "components/cryptauth/sync_scheduler_impl.h" |
13 #include "components/prefs/pref_registry_simple.h" | 16 #include "components/prefs/pref_registry_simple.h" |
14 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
15 #include "components/prefs/scoped_user_pref_update.h" | 18 #include "components/prefs/scoped_user_pref_update.h" |
16 #include "components/proximity_auth/cryptauth/cryptauth_client.h" | |
17 #include "components/proximity_auth/cryptauth/pref_names.h" | |
18 #include "components/proximity_auth/cryptauth/sync_scheduler_impl.h" | |
19 #include "components/proximity_auth/logging/logging.h" | 19 #include "components/proximity_auth/logging/logging.h" |
20 | 20 |
21 namespace proximity_auth { | 21 namespace cryptauth { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // The normal period between successful syncs, in hours. | 25 // The normal period between successful syncs, in hours. |
26 const int kRefreshPeriodHours = 24; | 26 const int kRefreshPeriodHours = 24; |
27 | 27 |
28 // A more aggressive period between sync attempts to recover when the last | 28 // A more aggressive period between sync attempts to recover when the last |
29 // sync attempt fails, in minutes. This is a base time that increases for each | 29 // sync attempt fails, in minutes. This is a base time that increases for each |
30 // subsequent failure. | 30 // subsequent failure. |
31 const int kDeviceSyncBaseRecoveryPeriodMinutes = 10; | 31 const int kDeviceSyncBaseRecoveryPeriodMinutes = 10; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 cryptauth::GetMyDevicesRequest request; | 301 cryptauth::GetMyDevicesRequest request; |
302 request.set_invocation_reason(invocation_reason); | 302 request.set_invocation_reason(invocation_reason); |
303 request.set_allow_stale_read(is_sync_speculative); | 303 request.set_allow_stale_read(is_sync_speculative); |
304 cryptauth_client_->GetMyDevices( | 304 cryptauth_client_->GetMyDevices( |
305 request, base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesSuccess, | 305 request, base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesSuccess, |
306 weak_ptr_factory_.GetWeakPtr()), | 306 weak_ptr_factory_.GetWeakPtr()), |
307 base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesFailure, | 307 base::Bind(&CryptAuthDeviceManager::OnGetMyDevicesFailure, |
308 weak_ptr_factory_.GetWeakPtr())); | 308 weak_ptr_factory_.GetWeakPtr())); |
309 } | 309 } |
310 | 310 |
311 } // namespace proximity_auth | 311 } // namespace cryptauth |
OLD | NEW |