Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: components/proximity_auth/ble/proximity_auth_ble_system.h

Issue 1102473003: Unlock Chrome when a phone with Smart Lock service is found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_screen_lock
Patch Set: Nits Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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);
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.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698