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