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 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H |
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Represents whether the list of unlock keys has changed after a sync | 37 // Represents whether the list of unlock keys has changed after a sync |
38 // attempt completes. | 38 // attempt completes. |
39 enum class DeviceChangeResult { | 39 enum class DeviceChangeResult { |
40 UNCHANGED, | 40 UNCHANGED, |
41 CHANGED, | 41 CHANGED, |
42 }; | 42 }; |
43 | 43 |
44 class Observer { | 44 class Observer { |
45 public: | 45 public: |
46 // Called when a sync attempt is started. | 46 // Called when a sync attempt is started. |
47 virtual void OnSyncStarted() = 0; | 47 virtual void OnSyncStarted() {} |
48 | 48 |
49 // Called when a sync attempt finishes with the |success| of the request. | 49 // Called when a sync attempt finishes with the |success| of the request. |
50 // |devices_changed| specifies if the sync caused the stored unlock keys to | 50 // |devices_changed| specifies if the sync caused the stored unlock keys to |
51 // change. | 51 // change. |
52 virtual void OnSyncFinished(SyncResult sync_result, | 52 virtual void OnSyncFinished(SyncResult sync_result, |
53 DeviceChangeResult device_change_result) = 0; | 53 DeviceChangeResult device_change_result) {} |
54 | 54 |
55 virtual ~Observer() {} | 55 virtual ~Observer() {} |
56 }; | 56 }; |
57 | 57 |
58 // Creates the manager: | 58 // Creates the manager: |
59 // |clock|: Used to determine the time between sync attempts. | 59 // |clock|: Used to determine the time between sync attempts. |
60 // |client_factory|: Creates CryptAuthClient instances to perform each sync. | 60 // |client_factory|: Creates CryptAuthClient instances to perform each sync. |
61 // |gcm_manager|: Notifies when GCM push messages trigger device syncs. | 61 // |gcm_manager|: Notifies when GCM push messages trigger device syncs. |
62 // Not owned and must outlive this instance. | 62 // Not owned and must outlive this instance. |
63 // |pref_service|: Stores syncing metadata and unlock key information to | 63 // |pref_service|: Stores syncing metadata and unlock key information to |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 base::ObserverList<Observer> observers_; | 160 base::ObserverList<Observer> observers_; |
161 | 161 |
162 base::WeakPtrFactory<CryptAuthDeviceManager> weak_ptr_factory_; | 162 base::WeakPtrFactory<CryptAuthDeviceManager> weak_ptr_factory_; |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(CryptAuthDeviceManager); | 164 DISALLOW_COPY_AND_ASSIGN(CryptAuthDeviceManager); |
165 }; | 165 }; |
166 | 166 |
167 } // namespace proximity_auth | 167 } // namespace proximity_auth |
168 | 168 |
169 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H | 169 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H |
OLD | NEW |