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

Side by Side Diff: chromeos/components/tether/ble_scanner.h

Issue 2697763002: [CrOS Tether]: Create BleConnectionManager, which manages secure connections between the current de… (Closed)
Patch Set: Add missing DEP. Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROMEOS_COMPONENTS_BLE_SCANNER_H_ 5 #ifndef CHROMEOS_COMPONENTS_BLE_SCANNER_H_
6 #define CHROMEOS_COMPONENTS_BLE_SCANNER_H_ 6 #define CHROMEOS_COMPONENTS_BLE_SCANNER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 18 matching lines...) Expand all
29 class Observer { 29 class Observer {
30 public: 30 public:
31 virtual void OnReceivedAdvertisementFromDevice( 31 virtual void OnReceivedAdvertisementFromDevice(
32 const std::string& device_address, 32 const std::string& device_address,
33 cryptauth::RemoteDevice remote_device) = 0; 33 cryptauth::RemoteDevice remote_device) = 0;
34 }; 34 };
35 35
36 BleScanner(const LocalDeviceDataProvider* local_device_data_provider); 36 BleScanner(const LocalDeviceDataProvider* local_device_data_provider);
37 ~BleScanner() override; 37 ~BleScanner() override;
38 38
39 bool RegisterScanFilterForDevice( 39 virtual bool RegisterScanFilterForDevice(
40 const cryptauth::RemoteDevice& remote_device); 40 const cryptauth::RemoteDevice& remote_device);
41 bool UnregisterScanFilterForDevice( 41 virtual bool UnregisterScanFilterForDevice(
42 const cryptauth::RemoteDevice& remote_device); 42 const cryptauth::RemoteDevice& remote_device);
43 43
44 bool IsDeviceRegistered(const std::string& device_id); 44 bool IsDeviceRegistered(const std::string& device_id);
45 45
46 void AddObserver(Observer* observer); 46 void AddObserver(Observer* observer);
47 void RemoveObserver(Observer* observer); 47 void RemoveObserver(Observer* observer);
48 48
49 // device::BluetoothAdapter::Observer 49 // device::BluetoothAdapter::Observer
50 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, 50 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
51 bool powered) override; 51 bool powered) override;
52 void DeviceAdded(device::BluetoothAdapter* adapter, 52 void DeviceAdded(device::BluetoothAdapter* adapter,
53 device::BluetoothDevice* bluetooth_device) override; 53 device::BluetoothDevice* bluetooth_device) override;
54 void DeviceChanged(device::BluetoothAdapter* adapter, 54 void DeviceChanged(device::BluetoothAdapter* adapter,
55 device::BluetoothDevice* bluetooth_device) override; 55 device::BluetoothDevice* bluetooth_device) override;
56 56
57 protected:
58 base::ObserverList<Observer> observer_list_;
59
57 private: 60 private:
58 friend class BleScannerTest; 61 friend class BleScannerTest;
59 62
60 class Delegate { 63 class Delegate {
61 public: 64 public:
62 virtual ~Delegate() {} 65 virtual ~Delegate() {}
63 virtual bool IsBluetoothAdapterAvailable() const = 0; 66 virtual bool IsBluetoothAdapterAvailable() const = 0;
64 virtual void GetAdapter( 67 virtual void GetAdapter(
65 const device::BluetoothAdapterFactory::AdapterCallback& callback) = 0; 68 const device::BluetoothAdapterFactory::AdapterCallback& callback) = 0;
66 virtual const std::vector<uint8_t>* GetServiceDataForUUID( 69 virtual const std::vector<uint8_t>* GetServiceDataForUUID(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const LocalDeviceDataProvider* local_device_data_provider_; 107 const LocalDeviceDataProvider* local_device_data_provider_;
105 108
106 bool is_initializing_adapter_; 109 bool is_initializing_adapter_;
107 scoped_refptr<device::BluetoothAdapter> adapter_; 110 scoped_refptr<device::BluetoothAdapter> adapter_;
108 111
109 bool is_initializing_discovery_session_; 112 bool is_initializing_discovery_session_;
110 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; 113 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_;
111 114
112 std::vector<cryptauth::RemoteDevice> registered_remote_devices_; 115 std::vector<cryptauth::RemoteDevice> registered_remote_devices_;
113 116
114 base::ObserverList<Observer> observer_list_;
115
116 base::WeakPtrFactory<BleScanner> weak_ptr_factory_; 117 base::WeakPtrFactory<BleScanner> weak_ptr_factory_;
117 118
118 DISALLOW_COPY_AND_ASSIGN(BleScanner); 119 DISALLOW_COPY_AND_ASSIGN(BleScanner);
119 }; 120 };
120 121
121 } // namespace tether 122 } // namespace tether
122 123
123 } // namespace chromeos 124 } // namespace chromeos
124 125
125 #endif // CHROMEOS_COMPONENTS_BLE_SCANNER_H_ 126 #endif // CHROMEOS_COMPONENTS_BLE_SCANNER_H_
OLDNEW
« no previous file with comments | « chromeos/components/tether/ble_constants.cc ('k') | chromeos/components/tether/proto/tether.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698