Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / device / bluetooth / bluetooth_adapter_mac.h
index 064b6bf..a166aec 100644 (file)
 #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 {
 
@@ -42,7 +35,9 @@ class BluetoothAdapterMacTest;
 
 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;
@@ -76,12 +71,11 @@ class BluetoothAdapterMac : public BluetoothAdapter {
                              bool aborted);
 
  protected:
-  // BluetoothAdapter override
+  // BluetoothAdapter:
   virtual void RemovePairingDelegateInternal(
       device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE;
 
  private:
-  friend class BluetoothAdapterFactory;
   friend class BluetoothAdapterMacTest;
 
   enum DiscoveryStatus {
@@ -94,7 +88,7 @@ class BluetoothAdapterMac : public BluetoothAdapter {
   BluetoothAdapterMac();
   virtual ~BluetoothAdapterMac();
 
-  // BluetoothAdapter override.
+  // BluetoothAdapter:
   virtual void AddDiscoverySession(
       const base::Closure& callback,
       const ErrorCallback& error_callback) OVERRIDE;
@@ -126,8 +120,8 @@ class BluetoothAdapterMac : public BluetoothAdapter {
   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
@@ -136,7 +130,7 @@ class BluetoothAdapterMac : public BluetoothAdapter {
 
   // 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_;