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..c722f651cb1648a2e8c98808b259fe66ba7dacbd 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,12 @@ 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(); |
+ // Returns true if adapter_ has been initialized for testing or bluetooth |
+ // adapter is available for the current platform. |
+ bool IsBluetoothSupported() const; |
+ |
+ void RunCallbackOnAdapterReady( |
+ const device::BluetoothAdapterFactory::AdapterCallback& callback); |
// Called when a bluetooth event listener is added. |
void OnListenerAdded(); |
@@ -74,6 +79,7 @@ class ExtensionBluetoothEventRouter |
} |
private: |
void InitializeAdapterIfNeeded(); |
+ void InitializeAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
void MaybeReleaseAdapter(); |
void DispatchAdapterStateEvent(); |
@@ -97,6 +103,8 @@ class ExtensionBluetoothEventRouter |
DeviceList; |
DeviceList discovered_devices_; |
+ base::WeakPtrFactory<ExtensionBluetoothEventRouter> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); |
}; |