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_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ |
6 #define COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ | 6 #define COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/proximity_auth/screenlock_bridge.h" | 10 #include "components/proximity_auth/screenlock_bridge.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class BrowserContext; | 13 class BrowserContext; |
14 } | 14 } |
15 | 15 |
16 namespace device { | 16 namespace device { |
17 class BluetoothGattConnection; | 17 class BluetoothGattConnection; |
18 } | 18 } |
19 | 19 |
20 namespace proximity_auth { | 20 namespace proximity_auth { |
21 | 21 |
| 22 class BluetoothLowEnergyConnection; |
22 class BluetoothLowEnergyConnectionFinder; | 23 class BluetoothLowEnergyConnectionFinder; |
| 24 class Connection; |
23 | 25 |
24 // This is the main entry point to start Proximity Auth over Bluetooth Low | 26 // This is the main entry point to start Proximity Auth over Bluetooth Low |
25 // Energy. This is the underlying system for the Smart Lock features. It will | 27 // Energy. This is the underlying system for the Smart Lock features. It will |
26 // discover Bluetooth Low Energy phones and unlock the lock screen if the phone | 28 // discover Bluetooth Low Energy phones and unlock the lock screen if the phone |
27 // passes an authorization and authentication protocol. | 29 // passes an authorization and authentication protocol. |
28 class ProximityAuthBleSystem : public ScreenlockBridge::Observer { | 30 class ProximityAuthBleSystem : public ScreenlockBridge::Observer { |
29 public: | 31 public: |
30 ProximityAuthBleSystem(ScreenlockBridge* screenlock_bridge, | 32 ProximityAuthBleSystem(ScreenlockBridge* screenlock_bridge, |
31 content::BrowserContext* browser_context); | 33 content::BrowserContext* browser_context); |
32 ~ProximityAuthBleSystem() override; | 34 ~ProximityAuthBleSystem() override; |
33 | 35 |
34 // ScreenlockBridge::Observer: | 36 // ScreenlockBridge::Observer: |
35 void OnScreenDidLock( | 37 void OnScreenDidLock( |
36 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 38 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
37 void OnScreenDidUnlock( | 39 void OnScreenDidUnlock( |
38 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 40 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
39 void OnFocusedUserChanged(const std::string& user_id) override; | 41 void OnFocusedUserChanged(const std::string& user_id) override; |
40 | 42 |
41 private: | 43 private: |
42 // Handler for a new connection found event. | 44 // Handler for a new connection found event. |
43 void OnConnectionFound( | 45 void OnConnectionFound(scoped_ptr<Connection> connection); |
44 scoped_ptr<device::BluetoothGattConnection> connection); | |
45 | 46 |
46 ScreenlockBridge* screenlock_bridge_; // Not owned. Must outlive this object. | 47 ScreenlockBridge* screenlock_bridge_; // Not owned. Must outlive this object. |
47 content::BrowserContext* | 48 content::BrowserContext* |
48 browser_context_; // Not owned. Must outlive this object. | 49 browser_context_; // Not owned. Must outlive this object. |
49 | 50 |
50 scoped_ptr<BluetoothLowEnergyConnectionFinder> connection_finder_; | 51 scoped_ptr<BluetoothLowEnergyConnectionFinder> connection_finder_; |
51 | 52 |
| 53 scoped_ptr<Connection> connection_; |
| 54 |
52 base::WeakPtrFactory<ProximityAuthBleSystem> weak_ptr_factory_; | 55 base::WeakPtrFactory<ProximityAuthBleSystem> weak_ptr_factory_; |
53 | 56 |
54 DISALLOW_COPY_AND_ASSIGN(ProximityAuthBleSystem); | 57 DISALLOW_COPY_AND_ASSIGN(ProximityAuthBleSystem); |
55 }; | 58 }; |
56 | 59 |
57 } // namespace proximity_auth | 60 } // namespace proximity_auth |
58 | 61 |
59 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ | 62 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ |
OLD | NEW |