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

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

Issue 1377313002: Revert of Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 2 months 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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/prefs/pref_change_registrar.h" 13 #include "base/prefs/pref_change_registrar.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/signin/easy_unlock_service.h" 15 #include "chrome/browser/signin/easy_unlock_service.h"
16 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h"
17 #include "components/proximity_auth/screenlock_bridge.h" 16 #include "components/proximity_auth/screenlock_bridge.h"
18 #include "google_apis/gaia/oauth2_token_service.h" 17 #include "google_apis/gaia/oauth2_token_service.h"
19 18
20 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
21 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h" 20 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h"
22 #endif 21 #endif
23 22
24 namespace base { 23 namespace base {
25 class DictionaryValue; 24 class DictionaryValue;
26 class ListValue; 25 class ListValue;
27 } 26 }
28 27
29 namespace cryptauth { 28 namespace cryptauth {
30 class ToggleEasyUnlockResponse; 29 class ToggleEasyUnlockResponse;
31 } 30 }
32 31
33 namespace proximity_auth { 32 namespace proximity_auth {
34 class CryptAuthClient; 33 class CryptAuthClient;
34 class CryptAuthGCMManager;
35 class CryptAuthEnrollmentManager;
35 class CryptAuthDeviceManager; 36 class CryptAuthDeviceManager;
36 class CryptAuthEnrollmentManager;
37 class CryptAuthGCMManager;
38 class ProximityAuthPrefManager; 37 class ProximityAuthPrefManager;
39 class RemoteDeviceLoader;
40 } 38 }
41 39
42 class EasyUnlockAppManager; 40 class EasyUnlockAppManager;
43 class EasyUnlockToggleFlow; 41 class EasyUnlockToggleFlow;
44 class Profile; 42 class Profile;
45 43
46 // EasyUnlockService instance that should be used for regular, non-signin 44 // EasyUnlockService instance that should be used for regular, non-signin
47 // profiles. 45 // profiles.
48 class EasyUnlockServiceRegular 46 class EasyUnlockServiceRegular
49 : public EasyUnlockService, 47 : public EasyUnlockService,
50 public proximity_auth::ScreenlockBridge::Observer, 48 public proximity_auth::ScreenlockBridge::Observer,
51 public proximity_auth::CryptAuthDeviceManager::Observer,
52 public OAuth2TokenService::Observer { 49 public OAuth2TokenService::Observer {
53 public: 50 public:
54 explicit EasyUnlockServiceRegular(Profile* profile); 51 explicit EasyUnlockServiceRegular(Profile* profile);
55 ~EasyUnlockServiceRegular() override; 52 ~EasyUnlockServiceRegular() override;
56 53
57 // Returns the CryptAuthEnrollmentManager, which manages the profile's 54 // Returns the CryptAuthEnrollmentManager, which manages the profile's
58 // CryptAuth enrollment. 55 // CryptAuth enrollment.
59 proximity_auth::CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager(); 56 proximity_auth::CryptAuthEnrollmentManager* GetCryptAuthEnrollmentManager();
60 57
61 // Returns the CryptAuthEnrollmentManager, which manages the profile's 58 // Returns the CryptAuthEnrollmentManager, which manages the profile's
62 // synced devices from CryptAuth. 59 // synced devices from CryptAuth.
63 proximity_auth::CryptAuthDeviceManager* GetCryptAuthDeviceManager(); 60 proximity_auth::CryptAuthDeviceManager* GetCryptAuthDeviceManager();
64 61
65 // Returns the ProximityAuthPrefManager, which manages the profile's 62 // Returns the ProximityAuthPrefManager, which manages the profile's
66 // prefs for proximity_auth classes. 63 // prefs for proximity_auth classes.
67 proximity_auth::ProximityAuthPrefManager* GetProximityAuthPrefManager(); 64 proximity_auth::ProximityAuthPrefManager* GetProximityAuthPrefManager();
68 65
69 private: 66 private:
70 // Loads the RemoteDevice instances that will be supplied to
71 // ProximityAuthSystem.
72 void LoadRemoteDevices();
73
74 // Called when |remote_device_loader_| completes.
75 void OnRemoteDevicesLoaded(
76 const std::vector<proximity_auth::RemoteDevice>& remote_devices);
77
78 // EasyUnlockService implementation: 67 // EasyUnlockService implementation:
79 EasyUnlockService::Type GetType() const override; 68 EasyUnlockService::Type GetType() const override;
80 std::string GetUserEmail() const override; 69 std::string GetUserEmail() const override;
81 void LaunchSetup() override; 70 void LaunchSetup() override;
82 const base::DictionaryValue* GetPermitAccess() const override; 71 const base::DictionaryValue* GetPermitAccess() const override;
83 void SetPermitAccess(const base::DictionaryValue& permit) override; 72 void SetPermitAccess(const base::DictionaryValue& permit) override;
84 void ClearPermitAccess() override; 73 void ClearPermitAccess() override;
85 const base::ListValue* GetRemoteDevices() const override; 74 const base::ListValue* GetRemoteDevices() const override;
86 void SetRemoteDevices(const base::ListValue& devices) override; 75 void SetRemoteDevices(const base::ListValue& devices) override;
87 void SetRemoteBleDevices(const base::ListValue& devices) override; 76 void SetRemoteBleDevices(const base::ListValue& devices) override;
88 void RunTurnOffFlow() override; 77 void RunTurnOffFlow() override;
89 void ResetTurnOffFlow() override; 78 void ResetTurnOffFlow() override;
90 TurnOffFlowStatus GetTurnOffFlowStatus() const override; 79 TurnOffFlowStatus GetTurnOffFlowStatus() const override;
91 std::string GetChallenge() const override; 80 std::string GetChallenge() const override;
92 std::string GetWrappedSecret() const override; 81 std::string GetWrappedSecret() const override;
93 void RecordEasySignInOutcome(const std::string& user_id, 82 void RecordEasySignInOutcome(const std::string& user_id,
94 bool success) const override; 83 bool success) const override;
95 void RecordPasswordLoginEvent(const std::string& user_id) const override; 84 void RecordPasswordLoginEvent(const std::string& user_id) const override;
96 void StartAutoPairing(const AutoPairingResultCallback& callback) override; 85 void StartAutoPairing(const AutoPairingResultCallback& callback) override;
97 void SetAutoPairingResult(bool success, const std::string& error) override; 86 void SetAutoPairingResult(bool success, const std::string& error) override;
98 void InitializeInternal() override; 87 void InitializeInternal() override;
99 void ShutdownInternal() override; 88 void ShutdownInternal() override;
100 bool IsAllowedInternal() const override; 89 bool IsAllowedInternal() const override;
101 void OnWillFinalizeUnlock(bool success) override; 90 void OnWillFinalizeUnlock(bool success) override;
102 void OnSuspendDoneInternal() override; 91 void OnSuspendDone() override;
103 92
104 // OAuth2TokenService::Observer: 93 // OAuth2TokenService::Observer:
105 void OnRefreshTokenAvailable(const std::string& account_id) override; 94 void OnRefreshTokenAvailable(const std::string& account_id) override;
106 95
107 // CryptAuthDeviceManager::Observer:
108 void OnSyncFinished(
109 proximity_auth::CryptAuthDeviceManager::SyncResult sync_result,
110 proximity_auth::CryptAuthDeviceManager::DeviceChangeResult
111 device_change_result) override;
112
113 // proximity_auth::ScreenlockBridge::Observer implementation: 96 // proximity_auth::ScreenlockBridge::Observer implementation:
114 void OnScreenDidLock(proximity_auth::ScreenlockBridge::LockHandler::ScreenType 97 void OnScreenDidLock(proximity_auth::ScreenlockBridge::LockHandler::ScreenType
115 screen_type) override; 98 screen_type) override;
116 void OnScreenDidUnlock( 99 void OnScreenDidUnlock(
117 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) 100 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type)
118 override; 101 override;
119 void OnFocusedUserChanged(const std::string& user_id) override; 102 void OnFocusedUserChanged(const std::string& user_id) override;
120 103
121 104
122 // Callback when the controlling pref changes. 105 // Callback when the controlling pref changes.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 158
176 // Managers responsible for handling syncing and communications with 159 // Managers responsible for handling syncing and communications with
177 // CryptAuth. 160 // CryptAuth.
178 scoped_ptr<proximity_auth::CryptAuthGCMManager> gcm_manager_; 161 scoped_ptr<proximity_auth::CryptAuthGCMManager> gcm_manager_;
179 scoped_ptr<proximity_auth::CryptAuthEnrollmentManager> enrollment_manager_; 162 scoped_ptr<proximity_auth::CryptAuthEnrollmentManager> enrollment_manager_;
180 scoped_ptr<proximity_auth::CryptAuthDeviceManager> device_manager_; 163 scoped_ptr<proximity_auth::CryptAuthDeviceManager> device_manager_;
181 164
182 // Manager responsible for handling the prefs used by proximity_auth classes. 165 // Manager responsible for handling the prefs used by proximity_auth classes.
183 scoped_ptr<proximity_auth::ProximityAuthPrefManager> pref_manager_; 166 scoped_ptr<proximity_auth::ProximityAuthPrefManager> pref_manager_;
184 167
185 // Loads the RemoteDevice instances from CryptAuth and local data.
186 scoped_ptr<proximity_auth::RemoteDeviceLoader> remote_device_loader_;
187
188 // If a new RemoteDevice was synced while the screen is locked, we defer
189 // loading the RemoteDevice until the screen is unlocked. For security,
190 // this deferment prevents the lock screen from being changed by a network
191 // event.
192 bool deferring_device_load_;
193
194 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_; 168 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_;
195 169
196 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular); 170 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular);
197 }; 171 };
198 172
199 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ 173 #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