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

Side by Side Diff: chrome/browser/signin/easy_unlock_service.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_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 namespace user_manager { 32 namespace user_manager {
33 class User; 33 class User;
34 } 34 }
35 35
36 namespace user_prefs { 36 namespace user_prefs {
37 class PrefRegistrySyncable; 37 class PrefRegistrySyncable;
38 } 38 }
39 39
40 namespace proximity_auth { 40 namespace proximity_auth {
41 class ProximityAuthBleSystem; 41 class ProximityAuthBleSystem;
42 class ProximityAuthSystem;
43 struct RemoteDevice;
42 } 44 }
43 45
44 class EasyUnlockAppManager; 46 class EasyUnlockAppManager;
45 class EasyUnlockServiceObserver; 47 class EasyUnlockServiceObserver;
46 class Profile; 48 class Profile;
47 class PrefRegistrySimple; 49 class PrefRegistrySimple;
48 50
49 class EasyUnlockService : public KeyedService { 51 class EasyUnlockService : public KeyedService {
50 public: 52 public:
51 enum TurnOffFlowStatus { 53 enum TurnOffFlowStatus {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Service type specific tests for whether the service is allowed. Returns 236 // Service type specific tests for whether the service is allowed. Returns
235 // false if service is not allowed. If true is returned, the service may still 237 // false if service is not allowed. If true is returned, the service may still
236 // not be allowed if common tests fail (e.g. if Bluetooth is not available). 238 // not be allowed if common tests fail (e.g. if Bluetooth is not available).
237 virtual bool IsAllowedInternal() const = 0; 239 virtual bool IsAllowedInternal() const = 0;
238 240
239 // Called while processing a user gesture to unlock the screen using Easy 241 // Called while processing a user gesture to unlock the screen using Easy
240 // Unlock, just before the screen is unlocked. 242 // Unlock, just before the screen is unlocked.
241 virtual void OnWillFinalizeUnlock(bool success) = 0; 243 virtual void OnWillFinalizeUnlock(bool success) = 0;
242 244
243 // Called when the local device resumes after a suspend. 245 // Called when the local device resumes after a suspend.
244 virtual void OnSuspendDone() = 0; 246 virtual void OnSuspendDoneInternal() = 0;
245 247
246 // KeyedService override: 248 // KeyedService override:
247 void Shutdown() override; 249 void Shutdown() override;
248 250
249 // Exposes the profile to which the service is attached to subclasses. 251 // Exposes the profile to which the service is attached to subclasses.
250 const Profile* profile() const { return profile_; } 252 const Profile* profile() const { return profile_; }
251 Profile* profile() { return profile_; } 253 Profile* profile() { return profile_; }
252 254
253 // Opens an Easy Unlock Setup app window. 255 // Opens an Easy Unlock Setup app window.
254 void OpenSetupApp(); 256 void OpenSetupApp();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Saves hardlock state for the given user. Update UI if the currently 289 // Saves hardlock state for the given user. Update UI if the currently
288 // associated user is the same. 290 // associated user is the same.
289 void SetHardlockStateForUser( 291 void SetHardlockStateForUser(
290 const std::string& user_id, 292 const std::string& user_id,
291 EasyUnlockScreenlockStateHandler::HardlockState state); 293 EasyUnlockScreenlockStateHandler::HardlockState state);
292 294
293 // Returns the authentication event for a recent password sign-in or unlock, 295 // Returns the authentication event for a recent password sign-in or unlock,
294 // according to the current state of the service. 296 // according to the current state of the service.
295 EasyUnlockAuthEvent GetPasswordAuthEvent() const; 297 EasyUnlockAuthEvent GetPasswordAuthEvent() const;
296 298
299 // Called by subclasses when the remote device allowed to unlock the screen
300 // changes. If |remote_device| is not null, then |proximity_auth_system_| will
301 // be recreated with the new remote device. Otherwise,
302 // |proximity_auth_system_| will be destroyed if no |remote_device| is set.
303 void OnRemoteDeviceChanged(const proximity_auth::RemoteDevice* remote_device);
304
297 private: 305 private:
298 // A class to detect whether a bluetooth adapter is present. 306 // A class to detect whether a bluetooth adapter is present.
299 class BluetoothDetector; 307 class BluetoothDetector;
300 308
301 // Initializes the service after EasyUnlockAppManager is ready. 309 // Initializes the service after EasyUnlockAppManager is ready.
302 void InitializeOnAppManagerReady(); 310 void InitializeOnAppManagerReady();
303 311
304 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not 312 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not
305 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance 313 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance
306 // is created. Do not cache the returned value, as it may go away if Easy 314 // is created. Do not cache the returned value, as it may go away if Easy
307 // Unlock gets disabled. 315 // Unlock gets disabled.
308 EasyUnlockScreenlockStateHandler* GetScreenlockStateHandler(); 316 EasyUnlockScreenlockStateHandler* GetScreenlockStateHandler();
309 317
310 // Callback when Bluetooth adapter present state changes. 318 // Callback when Bluetooth adapter present state changes.
311 void OnBluetoothAdapterPresentChanged(); 319 void OnBluetoothAdapterPresentChanged();
312 320
313 #if defined(OS_CHROMEOS) 321 #if defined(OS_CHROMEOS)
314 // Callback for get key operation from CheckCryptohomeKeysAndMaybeHardlock. 322 // Callback for get key operation from CheckCryptohomeKeysAndMaybeHardlock.
315 void OnCryptohomeKeysFetchedForChecking( 323 void OnCryptohomeKeysFetchedForChecking(
316 const std::string& user_id, 324 const std::string& user_id,
317 const std::set<std::string> paired_devices, 325 const std::set<std::string> paired_devices,
318 bool success, 326 bool success,
319 const chromeos::EasyUnlockDeviceKeyDataList& key_data_list); 327 const chromeos::EasyUnlockDeviceKeyDataList& key_data_list);
320 #endif 328 #endif
321 329
322 // Updates the service to state for handling system suspend. 330 // Updates the service to state for handling system suspend.
323 void PrepareForSuspend(); 331 void PrepareForSuspend();
324 332
333 // Called when the system resumes from a suspended state.
334 void OnSuspendDone();
335
325 void EnsureTpmKeyPresentIfNeeded(); 336 void EnsureTpmKeyPresentIfNeeded();
326 337
327 Profile* const profile_; 338 Profile* const profile_;
328 339
329 ChromeProximityAuthClient proximity_auth_client_; 340 ChromeProximityAuthClient proximity_auth_client_;
330 341
331 scoped_ptr<EasyUnlockAppManager> app_manager_; 342 scoped_ptr<EasyUnlockAppManager> app_manager_;
332 343
333 // Created lazily in |GetScreenlockStateHandler|. 344 // Created lazily in |GetScreenlockStateHandler|.
334 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_; 345 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_;
335 346
336 // The handler for the current auth attempt. Set iff an auth attempt is in 347 // The handler for the current auth attempt. Set iff an auth attempt is in
337 // progress. 348 // progress.
338 scoped_ptr<EasyUnlockAuthAttempt> auth_attempt_; 349 scoped_ptr<EasyUnlockAuthAttempt> auth_attempt_;
339 350
351 // Detects when the system Bluetooth adapter status changes.
340 scoped_ptr<BluetoothDetector> bluetooth_detector_; 352 scoped_ptr<BluetoothDetector> bluetooth_detector_;
341 353
342 // The proximity auth over Bluetooth Low Energy system. This is main entry 354 // Handles connecting, authenticating, and updating the UI on the lock/sign-in
343 // point to bootstap Smart Lock to discover phones over Bluetooth Low 355 // screen. After a |RemoteDevice| instance is provided, this object will
344 // Energy. 356 // handle the rest.
345 scoped_ptr<proximity_auth::ProximityAuthBleSystem> proximity_auth_ble_system_; 357 // TODO(tengs): This object is intended as a replacement of the background
358 // page of the easy_unlock Chrome app. We are in the process of removing the
359 // app in favor of |proximity_auth_system_|.
360 scoped_ptr<proximity_auth::ProximityAuthSystem> proximity_auth_system_;
346 361
347 #if defined(OS_CHROMEOS) 362 #if defined(OS_CHROMEOS)
348 // Monitors suspend and wake state of ChromeOS. 363 // Monitors suspend and wake state of ChromeOS.
349 class PowerMonitor; 364 class PowerMonitor;
350 scoped_ptr<PowerMonitor> power_monitor_; 365 scoped_ptr<PowerMonitor> power_monitor_;
351 #endif 366 #endif
352 367
353 // Whether the service has been shut down. 368 // Whether the service has been shut down.
354 bool shut_down_; 369 bool shut_down_;
355 370
356 bool tpm_key_checked_; 371 bool tpm_key_checked_;
357 372
358 base::ObserverList<EasyUnlockServiceObserver> observers_; 373 base::ObserverList<EasyUnlockServiceObserver> observers_;
359 374
360 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; 375 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_;
361 376
362 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); 377 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService);
363 }; 378 };
364 379
365 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ 380 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_auth_attempt.cc ('k') | chrome/browser/signin/easy_unlock_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698