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_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_IMPL_H |
6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_IMPL_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" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "components/proximity_auth/messenger_observer.h" | 12 #include "components/proximity_auth/messenger_observer.h" |
13 #include "components/proximity_auth/proximity_auth_system.h" | 13 #include "components/proximity_auth/proximity_auth_system.h" |
| 14 #include "components/proximity_auth/proximity_monitor_observer.h" |
14 #include "components/proximity_auth/remote_device_life_cycle.h" | 15 #include "components/proximity_auth/remote_device_life_cycle.h" |
15 #include "components/proximity_auth/remote_status_update.h" | 16 #include "components/proximity_auth/remote_status_update.h" |
16 #include "components/proximity_auth/screenlock_bridge.h" | 17 #include "components/proximity_auth/screenlock_bridge.h" |
17 #include "components/proximity_auth/screenlock_state.h" | 18 #include "components/proximity_auth/screenlock_state.h" |
18 #include "components/proximity_auth/unlock_manager.h" | 19 #include "components/proximity_auth/unlock_manager.h" |
19 #include "device/bluetooth/bluetooth_adapter.h" | 20 #include "device/bluetooth/bluetooth_adapter.h" |
20 | 21 |
21 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
22 #include "chromeos/dbus/power_manager_client.h" | 23 #include "chromeos/dbus/power_manager_client.h" |
23 #endif | 24 #endif |
24 | 25 |
25 namespace proximity_auth { | 26 namespace proximity_auth { |
26 | 27 |
27 class Messenger; | 28 class Messenger; |
28 class ProximityAuthClient; | 29 class ProximityAuthClient; |
29 class ProximityMonitor; | 30 class ProximityMonitor; |
30 | 31 |
31 // The unlock manager is responsible for controlling the lock screen UI based on | 32 // The unlock manager is responsible for controlling the lock screen UI based on |
32 // the authentication status of the registered remote devices. | 33 // the authentication status of the registered remote devices. |
33 class UnlockManagerImpl : public UnlockManager, | 34 class UnlockManagerImpl : public UnlockManager, |
34 public MessengerObserver, | 35 public MessengerObserver, |
| 36 public ProximityMonitorObserver, |
35 public ScreenlockBridge::Observer, | 37 public ScreenlockBridge::Observer, |
36 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
37 chromeos::PowerManagerClient::Observer, | 39 chromeos::PowerManagerClient::Observer, |
38 #endif // defined(OS_CHROMEOS) | 40 #endif // defined(OS_CHROMEOS) |
39 public device::BluetoothAdapter::Observer { | 41 public device::BluetoothAdapter::Observer { |
40 public: | 42 public: |
41 // The |proximity_auth_client| is not owned and should outlive the constructed | 43 // The |proximity_auth_client| is not owned and should outlive the constructed |
42 // unlock manager. | 44 // unlock manager. |
43 UnlockManagerImpl(ProximityAuthSystem::ScreenlockType screenlock_type, | 45 UnlockManagerImpl(ProximityAuthSystem::ScreenlockType screenlock_type, |
44 ProximityAuthClient* proximity_auth_client); | 46 ProximityAuthClient* proximity_auth_client); |
(...skipping 21 matching lines...) Expand all Loading... |
66 LOCKED, | 68 LOCKED, |
67 }; | 69 }; |
68 | 70 |
69 // MessengerObserver: | 71 // MessengerObserver: |
70 void OnUnlockEventSent(bool success) override; | 72 void OnUnlockEventSent(bool success) override; |
71 void OnRemoteStatusUpdate(const RemoteStatusUpdate& status_update) override; | 73 void OnRemoteStatusUpdate(const RemoteStatusUpdate& status_update) override; |
72 void OnDecryptResponse(const std::string& decrypted_bytes) override; | 74 void OnDecryptResponse(const std::string& decrypted_bytes) override; |
73 void OnUnlockResponse(bool success) override; | 75 void OnUnlockResponse(bool success) override; |
74 void OnDisconnected() override; | 76 void OnDisconnected() override; |
75 | 77 |
| 78 // ProximityMonitorObserver: |
| 79 void OnProximityStateChanged() override; |
| 80 |
76 // ScreenlockBridge::Observer | 81 // ScreenlockBridge::Observer |
77 void OnScreenDidLock( | 82 void OnScreenDidLock( |
78 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 83 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
79 void OnScreenDidUnlock( | 84 void OnScreenDidUnlock( |
80 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 85 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
81 void OnFocusedUserChanged(const AccountId& account_id) override; | 86 void OnFocusedUserChanged(const AccountId& account_id) override; |
82 | 87 |
83 // Called when the screenlock state changes. | 88 // Called when the screenlock state changes. |
84 void OnScreenLockedOrUnlocked(bool is_locked); | 89 void OnScreenLockedOrUnlocked(bool is_locked); |
85 | 90 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 188 |
184 // Used to vend all other weak pointers. | 189 // Used to vend all other weak pointers. |
185 base::WeakPtrFactory<UnlockManagerImpl> weak_ptr_factory_; | 190 base::WeakPtrFactory<UnlockManagerImpl> weak_ptr_factory_; |
186 | 191 |
187 DISALLOW_COPY_AND_ASSIGN(UnlockManagerImpl); | 192 DISALLOW_COPY_AND_ASSIGN(UnlockManagerImpl); |
188 }; | 193 }; |
189 | 194 |
190 } // namespace proximity_auth | 195 } // namespace proximity_auth |
191 | 196 |
192 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_IMPL_H | 197 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_IMPL_H |
OLD | NEW |