Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_mac.h |
| diff --git a/device/bluetooth/bluetooth_adapter_mac.h b/device/bluetooth/bluetooth_adapter_mac.h |
| index c8414817d89c1fdfff79cd178076f3009ed7d225..b6c3f209b6284f9a603c9f18ff2ea86a0908810d 100644 |
| --- a/device/bluetooth/bluetooth_adapter_mac.h |
| +++ b/device/bluetooth/bluetooth_adapter_mac.h |
| @@ -16,10 +16,9 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "device/bluetooth/bluetooth_adapter.h" |
| +#include "device/bluetooth/bluetooth_mac_discovery_manager.h" |
| -@class BluetoothAdapterMacDelegate; |
| @class IOBluetoothDevice; |
| -@class IOBluetoothDeviceInquiry; |
| @class NSArray; |
| @class NSDate; |
| @@ -33,7 +32,8 @@ namespace device { |
| class BluetoothAdapterMacTest; |
| -class BluetoothAdapterMac : public BluetoothAdapter { |
| +class BluetoothAdapterMac : public BluetoothAdapter, |
| + public BluetoothMacDiscoveryManager::Observer { |
| public: |
| static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
| @@ -70,13 +70,11 @@ class BluetoothAdapterMac : public BluetoothAdapter { |
| const CreateServiceCallback& callback, |
| const CreateServiceErrorCallback& error_callback) OVERRIDE; |
| - // called by BluetoothAdapterMacDelegate. |
| - void DeviceInquiryStarted(IOBluetoothDeviceInquiry* inquiry); |
| - void DeviceFound(IOBluetoothDeviceInquiry* inquiry, |
| - IOBluetoothDevice* device); |
| - void DeviceInquiryComplete(IOBluetoothDeviceInquiry* inquiry, |
| - IOReturn error, |
| - bool aborted); |
| + // BluetoothMacDiscoveryManager::Observer overrides |
| + virtual void DeviceFound(BluetoothMacDiscoveryManager* manager, |
| + IOBluetoothDevice* device) OVERRIDE; |
| + virtual void DiscoveryStopped(BluetoothMacDiscoveryManager* manager, |
| + bool unexpected) OVERRIDE; |
| protected: |
| // BluetoothAdapter: |
| @@ -86,13 +84,6 @@ class BluetoothAdapterMac : public BluetoothAdapter { |
| private: |
| friend class BluetoothAdapterMacTest; |
| - enum DiscoveryStatus { |
| - NOT_DISCOVERING, |
| - DISCOVERY_STARTING, |
| - DISCOVERING, |
| - DISCOVERY_STOPPING |
| - }; |
| - |
| BluetoothAdapterMac(); |
| virtual ~BluetoothAdapterMac(); |
| @@ -111,25 +102,14 @@ class BluetoothAdapterMac : public BluetoothAdapter { |
| // Updates |devices_| to be consistent with |devices|. |
| void UpdateDevices(NSArray* devices); |
| - void MaybeStartDeviceInquiry(); |
| - void MaybeStopDeviceInquiry(); |
| - |
| - typedef std::vector<std::pair<base::Closure, ErrorCallback> > |
| - DiscoveryCallbackList; |
| - void RunCallbacks(const DiscoveryCallbackList& callback_list, |
| - bool success) const; |
| - |
| std::string address_; |
| std::string name_; |
| bool powered_; |
| - DiscoveryStatus discovery_status_; |
| - DiscoveryCallbackList on_start_discovery_callbacks_; |
| - DiscoveryCallbackList on_stop_discovery_callbacks_; |
| - size_t num_discovery_listeners_; |
| + int num_discovery_sessions_; |
| - base::scoped_nsobject<BluetoothAdapterMacDelegate> adapter_delegate_; |
| - base::scoped_nsobject<IOBluetoothDeviceInquiry> device_inquiry_; |
| + // Discovery manager for classic discovery. |
|
Ilya Sherman
2014/06/10 01:10:59
Optional nit: I'd replace the second "discovery" w
armansito
2014/06/10 21:56:50
Done.
|
| + scoped_ptr<BluetoothMacDiscoveryManager> classic_discovery_manager_; |
| // A list of discovered device addresses. |
| // This list is used to check if the same device is discovered twice during |