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

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

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