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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.h

Issue 2502343003: Moved //components/proximity_auth/cryptauth to //components/cryptauth. (Closed)
Patch Set: Fixed proto #includes. Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/signin/easy_unlock_service.h" 15 #include "chrome/browser/signin/easy_unlock_service.h"
16 #include "components/cryptauth/cryptauth_device_manager.h"
16 #include "components/prefs/pref_change_registrar.h" 17 #include "components/prefs/pref_change_registrar.h"
17 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h"
18 #include "components/proximity_auth/screenlock_bridge.h" 18 #include "components/proximity_auth/screenlock_bridge.h"
19 #include "google_apis/gaia/oauth2_token_service.h" 19 #include "google_apis/gaia/oauth2_token_service.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h" 22 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h"
23 #endif 23 #endif
24 24
25 namespace base { 25 namespace base {
26 class DictionaryValue; 26 class DictionaryValue;
27 class ListValue; 27 class ListValue;
28 } 28 }
29 29
30 namespace cryptauth { 30 namespace cryptauth {
31 class CryptAuthClient;
32 class CryptAuthDeviceManager;
33 class CryptAuthEnrollmentManager;
34 class CryptAuthGCMManager;
31 class ToggleEasyUnlockResponse; 35 class ToggleEasyUnlockResponse;
32 } 36 }
33 37
34 namespace proximity_auth { 38 namespace proximity_auth {
35 class CryptAuthClient;
36 class CryptAuthDeviceManager;
37 class CryptAuthEnrollmentManager;
38 class CryptAuthGCMManager;
39 class ProximityAuthPrefManager; 39 class ProximityAuthPrefManager;
40 class RemoteDeviceLoader; 40 class RemoteDeviceLoader;
41 } 41 }
42 42
43 class EasyUnlockAppManager; 43 class EasyUnlockAppManager;
44 class EasyUnlockToggleFlow; 44 class EasyUnlockToggleFlow;
45 class Profile; 45 class Profile;
46 46
47 // EasyUnlockService instance that should be used for regular, non-signin 47 // EasyUnlockService instance that should be used for regular, non-signin
48 // profiles. 48 // profiles.
49 class EasyUnlockServiceRegular 49 class EasyUnlockServiceRegular
50 : public EasyUnlockService, 50 : public EasyUnlockService,
51 public proximity_auth::ScreenlockBridge::Observer, 51 public proximity_auth::ScreenlockBridge::Observer,
52 public proximity_auth::CryptAuthDeviceManager::Observer, 52 public cryptauth::CryptAuthDeviceManager::Observer,
53 public OAuth2TokenService::Observer { 53 public OAuth2TokenService::Observer {
54 public: 54 public:
55 explicit EasyUnlockServiceRegular(Profile* profile); 55 explicit EasyUnlockServiceRegular(Profile* profile);
56 ~EasyUnlockServiceRegular() override; 56 ~EasyUnlockServiceRegular() override;
57 57
58 // Returns the CryptAuthEnrollmentManager, which manages the profile's 58 // Returns the CryptAuthEnrollmentManager, which manages the profile's
59 // CryptAuth enrollment. 59 // CryptAuth enrollment.
60 proximity_auth::CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager(); 60 cryptauth::CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager();
61 61
62 // Returns the CryptAuthEnrollmentManager, which manages the profile's 62 // Returns the CryptAuthEnrollmentManager, which manages the profile's
63 // synced devices from CryptAuth. 63 // synced devices from CryptAuth.
64 proximity_auth::CryptAuthDeviceManager* GetCryptAuthDeviceManager(); 64 cryptauth::CryptAuthDeviceManager* GetCryptAuthDeviceManager();
65 65
66 // Returns the ProximityAuthPrefManager, which manages the profile's 66 // Returns the ProximityAuthPrefManager, which manages the profile's
67 // prefs for proximity_auth classes. 67 // prefs for proximity_auth classes.
68 proximity_auth::ProximityAuthPrefManager* GetProximityAuthPrefManager(); 68 proximity_auth::ProximityAuthPrefManager* GetProximityAuthPrefManager();
69 69
70 private: 70 private:
71 // Loads the RemoteDevice instances that will be supplied to 71 // Loads the RemoteDevice instances that will be supplied to
72 // ProximityAuthSystem. 72 // ProximityAuthSystem.
73 void LoadRemoteDevices(); 73 void LoadRemoteDevices();
74 74
(...skipping 25 matching lines...) Expand all
100 void ShutdownInternal() override; 100 void ShutdownInternal() override;
101 bool IsAllowedInternal() const override; 101 bool IsAllowedInternal() const override;
102 void OnWillFinalizeUnlock(bool success) override; 102 void OnWillFinalizeUnlock(bool success) override;
103 void OnSuspendDoneInternal() override; 103 void OnSuspendDoneInternal() override;
104 104
105 // OAuth2TokenService::Observer: 105 // OAuth2TokenService::Observer:
106 void OnRefreshTokenAvailable(const std::string& account_id) override; 106 void OnRefreshTokenAvailable(const std::string& account_id) override;
107 107
108 // CryptAuthDeviceManager::Observer: 108 // CryptAuthDeviceManager::Observer:
109 void OnSyncFinished( 109 void OnSyncFinished(
110 proximity_auth::CryptAuthDeviceManager::SyncResult sync_result, 110 cryptauth::CryptAuthDeviceManager::SyncResult sync_result,
111 proximity_auth::CryptAuthDeviceManager::DeviceChangeResult 111 cryptauth::CryptAuthDeviceManager::DeviceChangeResult
112 device_change_result) override; 112 device_change_result) override;
113 113
114 // proximity_auth::ScreenlockBridge::Observer implementation: 114 // proximity_auth::ScreenlockBridge::Observer implementation:
115 void OnScreenDidLock(proximity_auth::ScreenlockBridge::LockHandler::ScreenType 115 void OnScreenDidLock(proximity_auth::ScreenlockBridge::LockHandler::ScreenType
116 screen_type) override; 116 screen_type) override;
117 void OnScreenDidUnlock( 117 void OnScreenDidUnlock(
118 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) 118 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type)
119 override; 119 override;
120 void OnFocusedUserChanged(const AccountId& account_id) override; 120 void OnFocusedUserChanged(const AccountId& account_id) override;
121 121
(...skipping 29 matching lines...) Expand all
151 // can be accessed on the sign-in screen. 151 // can be accessed on the sign-in screen.
152 void SyncProfilePrefsToLocalState(); 152 void SyncProfilePrefsToLocalState();
153 153
154 // Returns the base GcmDeviceInfo proto containing the device's platform and 154 // Returns the base GcmDeviceInfo proto containing the device's platform and
155 // version information. 155 // version information.
156 cryptauth::GcmDeviceInfo GetGcmDeviceInfo(); 156 cryptauth::GcmDeviceInfo GetGcmDeviceInfo();
157 157
158 PrefChangeRegistrar registrar_; 158 PrefChangeRegistrar registrar_;
159 159
160 TurnOffFlowStatus turn_off_flow_status_; 160 TurnOffFlowStatus turn_off_flow_status_;
161 std::unique_ptr<proximity_auth::CryptAuthClient> cryptauth_client_; 161 std::unique_ptr<cryptauth::CryptAuthClient> cryptauth_client_;
162 162
163 AutoPairingResultCallback auto_pairing_callback_; 163 AutoPairingResultCallback auto_pairing_callback_;
164 164
165 // True if the user just unlocked the screen using Easy Unlock. Reset once 165 // True if the user just unlocked the screen using Easy Unlock. Reset once
166 // the screen unlocks. Used to distinguish Easy Unlock-powered unlocks from 166 // the screen unlocks. Used to distinguish Easy Unlock-powered unlocks from
167 // password-based unlocks for metrics. 167 // password-based unlocks for metrics.
168 bool will_unlock_using_easy_unlock_; 168 bool will_unlock_using_easy_unlock_;
169 169
170 // The timestamp for the most recent time when the lock screen was shown. The 170 // The timestamp for the most recent time when the lock screen was shown. The
171 // lock screen is typically shown when the user awakens their computer from 171 // lock screen is typically shown when the user awakens their computer from
172 // sleep -- e.g. by opening the lid -- but can also be shown if the screen is 172 // sleep -- e.g. by opening the lid -- but can also be shown if the screen is
173 // locked but the computer does not go to sleep. 173 // locked but the computer does not go to sleep.
174 base::TimeTicks lock_screen_last_shown_timestamp_; 174 base::TimeTicks lock_screen_last_shown_timestamp_;
175 175
176 // Managers responsible for handling syncing and communications with 176 // Managers responsible for handling syncing and communications with
177 // CryptAuth. 177 // CryptAuth.
178 std::unique_ptr<proximity_auth::CryptAuthGCMManager> gcm_manager_; 178 std::unique_ptr<cryptauth::CryptAuthGCMManager> gcm_manager_;
179 std::unique_ptr<proximity_auth::CryptAuthEnrollmentManager> 179 std::unique_ptr<cryptauth::CryptAuthEnrollmentManager>
180 enrollment_manager_; 180 enrollment_manager_;
181 std::unique_ptr<proximity_auth::CryptAuthDeviceManager> device_manager_; 181 std::unique_ptr<cryptauth::CryptAuthDeviceManager> device_manager_;
182 182
183 // Manager responsible for handling the prefs used by proximity_auth classes. 183 // Manager responsible for handling the prefs used by proximity_auth classes.
184 std::unique_ptr<proximity_auth::ProximityAuthPrefManager> pref_manager_; 184 std::unique_ptr<proximity_auth::ProximityAuthPrefManager> pref_manager_;
185 185
186 // Loads the RemoteDevice instances from CryptAuth and local data. 186 // Loads the RemoteDevice instances from CryptAuth and local data.
187 std::unique_ptr<proximity_auth::RemoteDeviceLoader> remote_device_loader_; 187 std::unique_ptr<proximity_auth::RemoteDeviceLoader> remote_device_loader_;
188 188
189 // If a new RemoteDevice was synced while the screen is locked, we defer 189 // If a new RemoteDevice was synced while the screen is locked, we defer
190 // loading the RemoteDevice until the screen is unlocked. For security, 190 // loading the RemoteDevice until the screen is unlocked. For security,
191 // this deferment prevents the lock screen from being changed by a network 191 // this deferment prevents the lock screen from being changed by a network
192 // event. 192 // event.
193 bool deferring_device_load_; 193 bool deferring_device_load_;
194 194
195 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_; 195 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_;
196 196
197 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular); 197 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular);
198 }; 198 };
199 199
200 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ 200 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.cc ('k') | chrome/browser/signin/easy_unlock_service_regular.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698