Index: device/bluetooth/bluetooth_adapter_mac.h |
diff --git a/device/bluetooth/bluetooth_adapter_mac.h b/device/bluetooth/bluetooth_adapter_mac.h |
index 1d65f68be41f53bbac2cffb651af1d909343ddd1..02a6e8a7f04b84b4d32de025f79a1baa8c986aec 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_discovery_manager_mac.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 BluetoothDiscoveryManagerMac::Observer { |
public: |
static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
@@ -69,13 +69,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); |
+ // BluetoothDiscoveryManagerMac::Observer overrides |
+ virtual void DeviceFound(BluetoothDiscoveryManagerMac* manager, |
+ IOBluetoothDevice* device) OVERRIDE; |
+ virtual void DiscoveryStopped(BluetoothDiscoveryManagerMac* manager, |
+ bool unexpected) OVERRIDE; |
protected: |
// BluetoothAdapter: |
@@ -85,13 +83,6 @@ class BluetoothAdapterMac : public BluetoothAdapter { |
private: |
friend class BluetoothAdapterMacTest; |
- enum DiscoveryStatus { |
- NOT_DISCOVERING, |
- DISCOVERY_STARTING, |
- DISCOVERING, |
- DISCOVERY_STOPPING |
- }; |
- |
BluetoothAdapterMac(); |
virtual ~BluetoothAdapterMac(); |
@@ -110,25 +101,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 Bluetooth Classic. |
+ scoped_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; |
// A list of discovered device addresses. |
// This list is used to check if the same device is discovered twice during |