| OLD | NEW |
| 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 COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H | 6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/proximity_auth/remote_device.h" | 13 #include "components/cryptauth/remote_device.h" |
| 14 #include "components/proximity_auth/remote_device_life_cycle.h" | 14 #include "components/proximity_auth/remote_device_life_cycle.h" |
| 15 #include "components/proximity_auth/screenlock_bridge.h" | 15 #include "components/proximity_auth/screenlock_bridge.h" |
| 16 #include "components/signin/core/account_id/account_id.h" | 16 #include "components/signin/core/account_id/account_id.h" |
| 17 | 17 |
| 18 namespace proximity_auth { | 18 namespace proximity_auth { |
| 19 | 19 |
| 20 class ProximityAuthClient; | 20 class ProximityAuthClient; |
| 21 class RemoteDeviceLifeCycle; | 21 class RemoteDeviceLifeCycle; |
| 22 class UnlockManager; | 22 class UnlockManager; |
| 23 | 23 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 // Starts the system to connect and authenticate when a registered user is | 38 // Starts the system to connect and authenticate when a registered user is |
| 39 // focused on the lock/sign-in screen. | 39 // focused on the lock/sign-in screen. |
| 40 void Start(); | 40 void Start(); |
| 41 | 41 |
| 42 // Stops the system. | 42 // Stops the system. |
| 43 void Stop(); | 43 void Stop(); |
| 44 | 44 |
| 45 // Registers a list of |remote_devices| for |account_id| that can be used for | 45 // Registers a list of |remote_devices| for |account_id| that can be used for |
| 46 // sign-in/unlock. If devices were previously registered for the user, then | 46 // sign-in/unlock. If devices were previously registered for the user, then |
| 47 // they will be replaced. | 47 // they will be replaced. |
| 48 void SetRemoteDevicesForUser(const AccountId& account_id, | 48 void SetRemoteDevicesForUser( |
| 49 const RemoteDeviceList& remote_devices); | 49 const AccountId& account_id, |
| 50 const cryptauth::RemoteDeviceList& remote_devices); |
| 50 | 51 |
| 51 // Returns the RemoteDevices registered for |account_id|. Returns an empty | 52 // Returns the RemoteDevices registered for |account_id|. Returns an empty |
| 52 // list | 53 // list |
| 53 // if no devices are registered for |account_id|. | 54 // if no devices are registered for |account_id|. |
| 54 RemoteDeviceList GetRemoteDevicesForUser(const AccountId& account_id) const; | 55 cryptauth::RemoteDeviceList GetRemoteDevicesForUser( |
| 56 const AccountId& account_id) const; |
| 55 | 57 |
| 56 // Called when the user clicks the user pod and attempts to unlock/sign-in. | 58 // Called when the user clicks the user pod and attempts to unlock/sign-in. |
| 57 void OnAuthAttempted(const AccountId& account_id); | 59 void OnAuthAttempted(const AccountId& account_id); |
| 58 | 60 |
| 59 // Called when the system suspends. | 61 // Called when the system suspends. |
| 60 void OnSuspend(); | 62 void OnSuspend(); |
| 61 | 63 |
| 62 // Called when the system wakes up from a suspended state. | 64 // Called when the system wakes up from a suspended state. |
| 63 void OnSuspendDone(); | 65 void OnSuspendDone(); |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 // RemoteDeviceLifeCycle::Observer: | 68 // RemoteDeviceLifeCycle::Observer: |
| 67 void OnLifeCycleStateChanged(RemoteDeviceLifeCycle::State old_state, | 69 void OnLifeCycleStateChanged(RemoteDeviceLifeCycle::State old_state, |
| 68 RemoteDeviceLifeCycle::State new_state) override; | 70 RemoteDeviceLifeCycle::State new_state) override; |
| 69 | 71 |
| 70 // ScreenlockBridge::Observer: | 72 // ScreenlockBridge::Observer: |
| 71 void OnScreenDidLock( | 73 void OnScreenDidLock( |
| 72 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 74 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
| 73 void OnScreenDidUnlock( | 75 void OnScreenDidUnlock( |
| 74 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 76 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
| 75 void OnFocusedUserChanged(const AccountId& account_id) override; | 77 void OnFocusedUserChanged(const AccountId& account_id) override; |
| 76 | 78 |
| 77 // Resumes |remote_device_life_cycle_| after device wakes up and waits a | 79 // Resumes |remote_device_life_cycle_| after device wakes up and waits a |
| 78 // timeout. | 80 // timeout. |
| 79 void ResumeAfterWakeUpTimeout(); | 81 void ResumeAfterWakeUpTimeout(); |
| 80 | 82 |
| 81 // Lists of remote devices, keyed by user account id. | 83 // Lists of remote devices, keyed by user account id. |
| 82 std::map<AccountId, RemoteDeviceList> remote_devices_map_; | 84 std::map<AccountId, cryptauth::RemoteDeviceList> remote_devices_map_; |
| 83 | 85 |
| 84 // Delegate for Chrome dependent functionality. | 86 // Delegate for Chrome dependent functionality. |
| 85 ProximityAuthClient* proximity_auth_client_; | 87 ProximityAuthClient* proximity_auth_client_; |
| 86 | 88 |
| 87 // Responsible for the life cycle of connecting and authenticating to | 89 // Responsible for the life cycle of connecting and authenticating to |
| 88 // the RemoteDevice of the currently focused user. | 90 // the RemoteDevice of the currently focused user. |
| 89 std::unique_ptr<RemoteDeviceLifeCycle> remote_device_life_cycle_; | 91 std::unique_ptr<RemoteDeviceLifeCycle> remote_device_life_cycle_; |
| 90 | 92 |
| 91 // Handles the interaction with the lock screen UI. | 93 // Handles the interaction with the lock screen UI. |
| 92 std::unique_ptr<UnlockManager> unlock_manager_; | 94 std::unique_ptr<UnlockManager> unlock_manager_; |
| 93 | 95 |
| 94 // True if the system is suspended. | 96 // True if the system is suspended. |
| 95 bool suspended_; | 97 bool suspended_; |
| 96 | 98 |
| 97 // True if the system is started_. | 99 // True if the system is started_. |
| 98 bool started_; | 100 bool started_; |
| 99 | 101 |
| 100 base::WeakPtrFactory<ProximityAuthSystem> weak_ptr_factory_; | 102 base::WeakPtrFactory<ProximityAuthSystem> weak_ptr_factory_; |
| 101 | 103 |
| 102 DISALLOW_COPY_AND_ASSIGN(ProximityAuthSystem); | 104 DISALLOW_COPY_AND_ASSIGN(ProximityAuthSystem); |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace proximity_auth | 107 } // namespace proximity_auth |
| 106 | 108 |
| 107 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H | 109 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H |
| OLD | NEW |