| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UNLOCK_MANAGER_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H | 6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void OnLifeCycleStateChanged(); | 55 void OnLifeCycleStateChanged(); |
| 56 | 56 |
| 57 // Called when the user pod is clicked for an authentication attempt of type | 57 // Called when the user pod is clicked for an authentication attempt of type |
| 58 // |auth_type|. | 58 // |auth_type|. |
| 59 // Exposed for testing. | 59 // Exposed for testing. |
| 60 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type); | 60 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type); |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 // Creates a ProximityMonitor instance for the given |remote_device|. | 63 // Creates a ProximityMonitor instance for the given |remote_device|. |
| 64 // Exposed for testing. | 64 // Exposed for testing. |
| 65 virtual scoped_ptr<ProximityMonitor> CreateProximityMonitor( | 65 virtual std::unique_ptr<ProximityMonitor> CreateProximityMonitor( |
| 66 const RemoteDevice& remote_device); | 66 const RemoteDevice& remote_device); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // The possible lock screen states for the remote device. | 69 // The possible lock screen states for the remote device. |
| 70 enum class RemoteScreenlockState { | 70 enum class RemoteScreenlockState { |
| 71 UNKNOWN, | 71 UNKNOWN, |
| 72 UNLOCKED, | 72 UNLOCKED, |
| 73 DISABLED, | 73 DISABLED, |
| 74 LOCKED, | 74 LOCKED, |
| 75 }; | 75 }; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Returns the Messenger instance associated with |life_cycle_|. This function | 139 // Returns the Messenger instance associated with |life_cycle_|. This function |
| 140 // will return nullptr if |life_cycle_| is not set or the remote device is not | 140 // will return nullptr if |life_cycle_| is not set or the remote device is not |
| 141 // yet authenticated. | 141 // yet authenticated. |
| 142 Messenger* GetMessenger(); | 142 Messenger* GetMessenger(); |
| 143 | 143 |
| 144 // Whether |this| manager is being used for sign-in or session unlock. | 144 // Whether |this| manager is being used for sign-in or session unlock. |
| 145 const ProximityAuthSystem::ScreenlockType screenlock_type_; | 145 const ProximityAuthSystem::ScreenlockType screenlock_type_; |
| 146 | 146 |
| 147 // Whether the user is present at the remote device. Unset if no remote status | 147 // Whether the user is present at the remote device. Unset if no remote status |
| 148 // update has yet been received. | 148 // update has yet been received. |
| 149 scoped_ptr<RemoteScreenlockState> remote_screenlock_state_; | 149 std::unique_ptr<RemoteScreenlockState> remote_screenlock_state_; |
| 150 | 150 |
| 151 // Controls the proximity auth flow logic for a remote device. Not owned, and | 151 // Controls the proximity auth flow logic for a remote device. Not owned, and |
| 152 // expcted to outlive |this| instance. | 152 // expcted to outlive |this| instance. |
| 153 RemoteDeviceLifeCycle* life_cycle_; | 153 RemoteDeviceLifeCycle* life_cycle_; |
| 154 | 154 |
| 155 // Tracks whether the remote device is currently in close enough proximity to | 155 // Tracks whether the remote device is currently in close enough proximity to |
| 156 // the local device to allow unlocking. | 156 // the local device to allow unlocking. |
| 157 scoped_ptr<ProximityMonitor> proximity_monitor_; | 157 std::unique_ptr<ProximityMonitor> proximity_monitor_; |
| 158 | 158 |
| 159 // Used to call into the embedder. Expected to outlive |this| instance. | 159 // Used to call into the embedder. Expected to outlive |this| instance. |
| 160 ProximityAuthClient* proximity_auth_client_; | 160 ProximityAuthClient* proximity_auth_client_; |
| 161 | 161 |
| 162 // Whether the screen is currently locked. | 162 // Whether the screen is currently locked. |
| 163 bool is_locked_; | 163 bool is_locked_; |
| 164 | 164 |
| 165 // True if the manager is currently processing a user-initiated authentication | 165 // True if the manager is currently processing a user-initiated authentication |
| 166 // attempt, which is initiated when the user pod is clicked. | 166 // attempt, which is initiated when the user pod is clicked. |
| 167 bool is_attempting_auth_; | 167 bool is_attempting_auth_; |
| 168 | 168 |
| 169 // Whether the system is waking up from sleep. | 169 // Whether the system is waking up from sleep. |
| 170 bool is_waking_up_; | 170 bool is_waking_up_; |
| 171 | 171 |
| 172 // The Bluetooth adapter. Null if there is no adapter present on the local | 172 // The Bluetooth adapter. Null if there is no adapter present on the local |
| 173 // device. | 173 // device. |
| 174 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 174 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
| 175 | 175 |
| 176 // The sign-in secret received from the remote device by decrypting the | 176 // The sign-in secret received from the remote device by decrypting the |
| 177 // sign-in challenge. | 177 // sign-in challenge. |
| 178 scoped_ptr<std::string> sign_in_secret_; | 178 std::unique_ptr<std::string> sign_in_secret_; |
| 179 | 179 |
| 180 // The state of the current screen lock UI. | 180 // The state of the current screen lock UI. |
| 181 ScreenlockState screenlock_state_; | 181 ScreenlockState screenlock_state_; |
| 182 | 182 |
| 183 // Used to clear the waking up state after a timeout. | 183 // Used to clear the waking up state after a timeout. |
| 184 base::WeakPtrFactory<UnlockManager> clear_waking_up_state_weak_ptr_factory_; | 184 base::WeakPtrFactory<UnlockManager> clear_waking_up_state_weak_ptr_factory_; |
| 185 | 185 |
| 186 // Used to reject auth attempts after a timeout. An in-progress auth attempt | 186 // Used to reject auth attempts after a timeout. An in-progress auth attempt |
| 187 // blocks the sign-in screen UI, so it's important to prevent the auth attempt | 187 // blocks the sign-in screen UI, so it's important to prevent the auth attempt |
| 188 // from blocking the UI in case a step in the code path hangs. | 188 // from blocking the UI in case a step in the code path hangs. |
| 189 base::WeakPtrFactory<UnlockManager> reject_auth_attempt_weak_ptr_factory_; | 189 base::WeakPtrFactory<UnlockManager> reject_auth_attempt_weak_ptr_factory_; |
| 190 | 190 |
| 191 // Used to vend all other weak pointers. | 191 // Used to vend all other weak pointers. |
| 192 base::WeakPtrFactory<UnlockManager> weak_ptr_factory_; | 192 base::WeakPtrFactory<UnlockManager> weak_ptr_factory_; |
| 193 | 193 |
| 194 DISALLOW_COPY_AND_ASSIGN(UnlockManager); | 194 DISALLOW_COPY_AND_ASSIGN(UnlockManager); |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 } // namespace proximity_auth | 197 } // namespace proximity_auth |
| 198 | 198 |
| 199 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H | 199 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H |
| OLD | NEW |