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 | 11 |
11 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h " | 12 namespace content { |
13 class BrowserContext; | |
14 } | |
15 | |
16 namespace device { | |
17 class BluetoothGattConnection; | |
18 } | |
12 | 19 |
13 namespace proximity_auth { | 20 namespace proximity_auth { |
14 | 21 |
22 class BluetoothLowEnergyConnectionFinder; | |
23 | |
15 // This is the main entry point to start Proximity Auth over Bluetooth Low | 24 // This is the main entry point to start Proximity Auth over Bluetooth Low |
16 // Energy. This is the underlying system for the Smart Lock features. It will | 25 // Energy. This is the underlying system for the Smart Lock features. It will |
17 // discover Bluetooth Low Energy phones and unlock the lock screen if the phone | 26 // discover Bluetooth Low Energy phones and unlock the lock screen if the phone |
18 // passes an authorization and authentication protocol. | 27 // passes an authorization and authentication protocol. |
19 class ProximityAuthBleSystem { | 28 class ProximityAuthBleSystem : public ScreenlockBridge::Observer { |
20 public: | 29 public: |
21 ProximityAuthBleSystem(); | 30 ProximityAuthBleSystem(ScreenlockBridge* screenlock_bridge, |
22 ~ProximityAuthBleSystem(); | 31 content::BrowserContext* browser_context); |
Ilya Sherman
2015/04/28 01:02:33
nit: Reminder: If you remove the |browser_context|
msarda
2015/04/28 12:44:59
I kept the browser_context but removed the include
Ilya Sherman
2015/04/28 23:21:25
I think it would be better to eliminate the hint o
| |
32 ~ProximityAuthBleSystem() override; | |
33 | |
34 // ScreenlockBridge::Observer: | |
35 void OnScreenDidLock( | |
36 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | |
37 void OnScreenDidUnlock( | |
38 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | |
39 void OnFocusedUserChanged(const std::string& user_id) override; | |
23 | 40 |
24 private: | 41 private: |
42 // Handler for a new connection found event. | |
43 void OnConnectionFound( | |
44 scoped_ptr<device::BluetoothGattConnection> connection); | |
45 | |
46 ScreenlockBridge* screenlock_bridge_; // Not owned. Must outlive this object. | |
47 content::BrowserContext* | |
48 browser_context_; // Not owned. Must outlive this object. | |
Ilya Sherman
2015/04/28 01:02:33
Hmm, before, we'd discussed keeping the BLE code's
msarda
2015/04/28 12:44:59
I removed the dependency and the DEPS rule as they
| |
49 | |
25 scoped_ptr<BluetoothLowEnergyConnectionFinder> connection_finder_; | 50 scoped_ptr<BluetoothLowEnergyConnectionFinder> connection_finder_; |
26 | 51 |
52 base::WeakPtrFactory<ProximityAuthBleSystem> weak_ptr_factory_; | |
53 | |
27 DISALLOW_COPY_AND_ASSIGN(ProximityAuthBleSystem); | 54 DISALLOW_COPY_AND_ASSIGN(ProximityAuthBleSystem); |
28 }; | 55 }; |
29 | 56 |
30 } // namespace proximity_auth | 57 } // namespace proximity_auth |
31 | 58 |
32 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ | 59 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_ |
OLD | NEW |