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

Side by Side Diff: components/cryptauth/cryptauth_device_manager.h

Issue 2561683002: Update CryptAuthDeviceManager to store all synced devices instead of only unlock keys. (Closed)
Patch Set: tengs@ comments. Created 4 years 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 unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 base::TimeDelta GetTimeToNextAttempt() const; 98 base::TimeDelta GetTimeToNextAttempt() const;
99 99
100 // Returns true if a device sync attempt is currently in progress. 100 // Returns true if a device sync attempt is currently in progress.
101 bool IsSyncInProgress() const; 101 bool IsSyncInProgress() const;
102 102
103 // Returns true if the last device sync failed and the manager is now 103 // Returns true if the last device sync failed and the manager is now
104 // scheduling sync attempts more aggressively to recover. If no enrollment 104 // scheduling sync attempts more aggressively to recover. If no enrollment
105 // has ever been recorded, then this function will also return true. 105 // has ever been recorded, then this function will also return true.
106 bool IsRecoveringFromFailure() const; 106 bool IsRecoveringFromFailure() const;
107 107
108 // Returns a list of all remote devices that have been synced.
109 std::vector<cryptauth::ExternalDeviceInfo> synced_devices() const;
Tim Song 2016/12/08 00:38:56 I would also CamelCase this function as well since
Kyle Horimoto 2016/12/08 00:46:33 Done.
110
108 // Returns a list of remote devices that can unlock the user's other devices. 111 // Returns a list of remote devices that can unlock the user's other devices.
109 const std::vector<cryptauth::ExternalDeviceInfo>& unlock_keys() const { 112 std::vector<cryptauth::ExternalDeviceInfo> UnlockKeys() const;
Tim Song 2016/12/08 00:38:56 By convention, this should be GetUnlockKeys().
Kyle Horimoto 2016/12/08 00:46:33 Done.
110 return unlock_keys_; 113
111 } 114 // Returns a list of remote devices that can host tether hotspots.
115 std::vector<cryptauth::ExternalDeviceInfo> TetherHosts() const;
Tim Song 2016/12/08 00:38:56 By convention, this should be GetTetherHosts().
Kyle Horimoto 2016/12/08 00:46:33 Done.
112 116
113 protected: 117 protected:
114 // Creates a new SyncScheduler instance. Exposed for testing. 118 // Creates a new SyncScheduler instance. Exposed for testing.
115 virtual std::unique_ptr<SyncScheduler> CreateSyncScheduler(); 119 virtual std::unique_ptr<SyncScheduler> CreateSyncScheduler();
116 120
117 private: 121 private:
118 // CryptAuthGCMManager::Observer: 122 // CryptAuthGCMManager::Observer:
119 void OnResyncMessage() override; 123 void OnResyncMessage() override;
120 124
121 // Updates |unlock_keys_| by fetching the list stored in |pref_service_|. 125 // Updates |unlock_keys_| by fetching the list stored in |pref_service_|.
(...skipping 15 matching lines...) Expand all
137 141
138 // Notifies when GCM push messages trigger device sync. Not owned and must 142 // Notifies when GCM push messages trigger device sync. Not owned and must
139 // outlive this instance. 143 // outlive this instance.
140 CryptAuthGCMManager* gcm_manager_; 144 CryptAuthGCMManager* gcm_manager_;
141 145
142 // Contains preferences that outlive the lifetime of this object and across 146 // Contains preferences that outlive the lifetime of this object and across
143 // process restarts. |pref_service_| must outlive the lifetime of this 147 // process restarts. |pref_service_| must outlive the lifetime of this
144 // instance. 148 // instance.
145 PrefService* const pref_service_; 149 PrefService* const pref_service_;
146 150
147 // The unlock keys currently synced from CryptAuth. 151 // All devices currently synced from CryptAuth.
148 std::vector<cryptauth::ExternalDeviceInfo> unlock_keys_; 152 std::vector<cryptauth::ExternalDeviceInfo> synced_devices_;
149 153
150 // Schedules the time between device sync attempts. 154 // Schedules the time between device sync attempts.
151 std::unique_ptr<SyncScheduler> scheduler_; 155 std::unique_ptr<SyncScheduler> scheduler_;
152 156
153 // Contains the SyncRequest that |scheduler_| requests when a device sync 157 // Contains the SyncRequest that |scheduler_| requests when a device sync
154 // attempt is made. 158 // attempt is made.
155 std::unique_ptr<SyncScheduler::SyncRequest> sync_request_; 159 std::unique_ptr<SyncScheduler::SyncRequest> sync_request_;
156 160
157 // The CryptAuthEnroller instance for the current sync attempt. A new 161 // The CryptAuthEnroller instance for the current sync attempt. A new
158 // instance will be created for each individual attempt. 162 // instance will be created for each individual attempt.
159 std::unique_ptr<CryptAuthClient> cryptauth_client_; 163 std::unique_ptr<CryptAuthClient> cryptauth_client_;
160 164
161 // List of observers. 165 // List of observers.
162 base::ObserverList<Observer> observers_; 166 base::ObserverList<Observer> observers_;
163 167
164 base::WeakPtrFactory<CryptAuthDeviceManager> weak_ptr_factory_; 168 base::WeakPtrFactory<CryptAuthDeviceManager> weak_ptr_factory_;
165 169
166 DISALLOW_COPY_AND_ASSIGN(CryptAuthDeviceManager); 170 DISALLOW_COPY_AND_ASSIGN(CryptAuthDeviceManager);
167 }; 171 };
168 172
169 } // namespace cryptauth 173 } // namespace cryptauth
170 174
171 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H 175 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_regular.cc ('k') | components/cryptauth/cryptauth_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698