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

Unified Diff: device/bluetooth/bluetooth_adapter_mac.h

Issue 1226133006: Move CBCentralManager from the Discovery Manager to Adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adddevs
Patch Set: comment edit Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_adapter_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_mac.h
diff --git a/device/bluetooth/bluetooth_adapter_mac.h b/device/bluetooth/bluetooth_adapter_mac.h
index e9a0b5dbcde97ea97c19ec12894cbd086ee5f1e7..d85c9b1eabd5a19c365899506c55d0a94dd99d57 100644
--- a/device/bluetooth/bluetooth_adapter_mac.h
+++ b/device/bluetooth/bluetooth_adapter_mac.h
@@ -32,9 +32,9 @@ class SequencedTaskRunner;
} // namespace base
-namespace device {
+@class BluetoothLowEnergyCentralManagerDelegate;
-class BluetoothAdapterMacTest;
+namespace device {
class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
: public BluetoothAdapter,
@@ -104,6 +104,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
const static NSTimeInterval kDiscoveryTimeoutSec;
friend class BluetoothAdapterMacTest;
+ friend class BluetoothLowEnergyCentralManagerBridge;
BluetoothAdapterMac();
~BluetoothAdapterMac() override;
@@ -136,6 +137,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
NSDictionary* advertisement_data,
int rssi) override;
+ // Updates |devices_| when there is a change to the CBCentralManager's state.
+ void LowEnergyCentralManagerUpdatedState();
+
// Removes from |devices_| any previously paired, connected or seen devices
// which are no longer present. Notifies observers.
void RemoveTimedOutDevices();
@@ -144,6 +148,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
// observers.
void AddPairedDevices();
+ // Private method for testing. Resets |low_energy_central_manager_| to
+ // |central_manager| and sets |low_energy_central_manager_delegate_| as its
+ // delegate. Should be called only when CoreBluetooth is available.
+ void SetCentralManagerForTesting(CBCentralManager* central_manager);
+
std::string address_;
std::string name_;
bool powered_;
@@ -157,6 +166,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
scoped_ptr<BluetoothLowEnergyDiscoveryManagerMac>
low_energy_discovery_manager_;
+ // Underlying CoreBluetooth CBCentralManager and its delegate.
+ base::scoped_nsobject<CBCentralManager> low_energy_central_manager_;
+ base::scoped_nsobject<BluetoothLowEnergyCentralManagerDelegate>
+ low_energy_central_manager_delegate_;
+
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_;
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_adapter_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698