Index: chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h |
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h |
index b93858acd9943e434d52af68d934e05f268c9b89..b0a59674a4b102baaf4a42eb086dd71d9a64233a 100644 |
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h |
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h |
@@ -9,8 +9,10 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_vector.h" |
+#include "base/memory/weak_ptr.h" |
#include "chrome/common/extensions/api/bluetooth.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
+#include "device/bluetooth/bluetooth_adapter_factory.h" |
#include "device/bluetooth/bluetooth_socket.h" |
class Profile; |
@@ -23,9 +25,8 @@ class ExtensionBluetoothEventRouter |
explicit ExtensionBluetoothEventRouter(Profile* profile); |
virtual ~ExtensionBluetoothEventRouter(); |
- // GetAdapter will return NULL if the bluetooth adapter is not |
- // supported in the current platform. |
- scoped_refptr<device::BluetoothAdapter> GetAdapter(); |
+ void RunCallbackOnAdapterReady( |
+ const device::BluetoothAdapterFactory::AdapterCallback& callback); |
// Called when a bluetooth event listener is added. |
void OnListenerAdded(); |
@@ -74,6 +75,7 @@ class ExtensionBluetoothEventRouter |
} |
private: |
void InitializeAdapterIfNeeded(); |
+ void InitializeAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
void MaybeReleaseAdapter(); |
void DispatchAdapterStateEvent(); |
@@ -97,6 +99,8 @@ class ExtensionBluetoothEventRouter |
DeviceList; |
DeviceList discovered_devices_; |
+ base::WeakPtrFactory<ExtensionBluetoothEventRouter> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); |
}; |