#include <vector>
#include "base/containers/hash_tables.h"
+#include "base/mac/scoped_nsobject.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#ifdef __OBJC__
@class BluetoothAdapterMacDelegate;
@class IOBluetoothDevice;
@class IOBluetoothDeviceInquiry;
@class NSArray;
@class NSDate;
-#else
-class BluetoothAdapterMacDelegate;
-class IOBluetoothDevice;
-class IOBluetoothDeviceInquiry;
-class NSArray;
-class NSDate;
-#endif
namespace base {
class BluetoothAdapterMac : public BluetoothAdapter {
public:
- // BluetoothAdapter override
+ static base::WeakPtr<BluetoothAdapter> CreateAdapter();
+
+ // BluetoothAdapter:
virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE;
virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE;
virtual std::string GetAddress() const OVERRIDE;
bool aborted);
protected:
- // BluetoothAdapter override
+ // BluetoothAdapter:
virtual void RemovePairingDelegateInternal(
device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE;
private:
- friend class BluetoothAdapterFactory;
friend class BluetoothAdapterMacTest;
enum DiscoveryStatus {
BluetoothAdapterMac();
virtual ~BluetoothAdapterMac();
- // BluetoothAdapter override.
+ // BluetoothAdapter:
virtual void AddDiscoverySession(
const base::Closure& callback,
const ErrorCallback& error_callback) OVERRIDE;
DiscoveryCallbackList on_stop_discovery_callbacks_;
size_t num_discovery_listeners_;
- BluetoothAdapterMacDelegate* adapter_delegate_;
- IOBluetoothDeviceInquiry* device_inquiry_;
+ base::scoped_nsobject<BluetoothAdapterMacDelegate> adapter_delegate_;
+ base::scoped_nsobject<IOBluetoothDeviceInquiry> device_inquiry_;
// A list of discovered device addresses.
// This list is used to check if the same device is discovered twice during
// Timestamp for the recently accessed device.
// Used to determine if |devices_| needs an update.
- NSDate* recently_accessed_device_timestamp_;
+ base::scoped_nsobject<NSDate> recently_accessed_device_timestamp_;
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;