Chromium Code Reviews| Index: components/proximity_auth/proximity_auth_system.h |
| diff --git a/components/proximity_auth/proximity_auth_system.h b/components/proximity_auth/proximity_auth_system.h |
| index 644d65dfe129c10647037fcbc775d79efedce2ea..b0f3ba6565a5678152ed90b2fb20a64015fc1960 100644 |
| --- a/components/proximity_auth/proximity_auth_system.h |
| +++ b/components/proximity_auth/proximity_auth_system.h |
| @@ -8,23 +8,73 @@ |
| #include <vector> |
| #include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "components/proximity_auth/remote_device.h" |
| +#include "components/proximity_auth/remote_device_life_cycle.h" |
| +#include "components/proximity_auth/screenlock_bridge.h" |
| namespace proximity_auth { |
| +class ProximityAuthClient; |
| +class RemoteDeviceLifeCycle; |
| +class UnlockManager; |
| + |
| // This is the main entry point to start Proximity Auth, the underlying system |
| -// for the Easy Unlock and Easy Sign-in features. Given a list of registered |
| -// remote devices (i.e. phones), this object will handle the connection, |
| -// authentication, and protocol for all the devices. |
| -class ProximityAuthSystem { |
| +// for the Smart Lock feature. Given a registered remote device (i.e. a phone), |
| +// this object will handle the connection, authentication, and protocol for the |
| +// device. |
| +class ProximityAuthSystem : public RemoteDeviceLifeCycle::Observer, |
| + public ScreenlockBridge::Observer { |
| public: |
| - ProximityAuthSystem(const std::vector<RemoteDevice>& remote_devices); |
| - virtual ~ProximityAuthSystem(); |
| + ProximityAuthSystem(RemoteDevice remote_device, |
| + ProximityAuthClient* proximity_auth_client); |
| + ~ProximityAuthSystem() override; |
| + |
| + // Starts the system to begin connecting and authenticating the remote device. |
| + void Start(); |
| + |
| + // Called when the user clicks the user pod and attempts to unlock/sign-in. |
| + void OnAuthAttempted(const std::string& user_id); |
| - const std::vector<RemoteDevice>& GetRemoteDevices(); |
| + // Called when the system suspends. |
| + void OnSuspend(); |
| + |
| + // Calls when the system wakes up from a suspended state. |
|
sacomoto
2015/09/29 20:58:33
nit: s/Calls/Called/.
Tim Song
2015/09/30 00:05:04
Done.
|
| + void OnSuspendDone(); |
| private: |
| - std::vector<RemoteDevice> remote_devices_; |
| + // RemoteDeviceLifeCycle::Observer: |
| + void OnLifeCycleStateChanged(RemoteDeviceLifeCycle::State old_state, |
| + RemoteDeviceLifeCycle::State new_state) override; |
| + |
| + // ScreenlockBridge::Observer: |
| + void OnScreenDidLock( |
| + ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
| + void OnScreenDidUnlock( |
| + ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
| + void OnFocusedUserChanged(const std::string& user_id) override; |
| + |
| + // Resumes |life_cycle_| after device wakes up and waits a timeout. |
|
sacomoto
2015/09/29 20:58:33
nit: |remote_device_life_cycle_|
Tim Song
2015/09/30 00:05:04
Done.
|
| + void ResumeAfterWakeUpTimeout(); |
| + |
| + // The remote device to connect to. |
| + RemoteDevice remote_device_; |
| + |
| + // Delegate for Chrome dependent functionality. |
| + ProximityAuthClient* proximity_auth_client_; |
| + |
| + // Responsible for the life cycle of connecting and authenticating to |
| + // |remote_device_|. |
| + scoped_ptr<RemoteDeviceLifeCycle> remote_device_life_cycle_; |
| + |
| + // Handles the interaction with the lock screen UI. |
| + scoped_ptr<UnlockManager> unlock_manager_; |
| + |
| + // True if the system is suspended. |
| + bool suspended_; |
| + |
| + base::WeakPtrFactory<ProximityAuthSystem> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(ProximityAuthSystem); |
| }; |