summaryrefslogtreecommitdiffstats
path: root/device/bluetooth/bluetooth_adapter_factory.cc
diff options
context:
space:
mode:
authoryoungki@chromium.org <youngki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 01:59:48 +0000
committeryoungki@chromium.org <youngki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 01:59:48 +0000
commitec9b06712a3cd52def1e8543178487a170fde46b (patch)
tree3cc0d41d3bf32c37c49fa1ffb8b415b200a65f6d /device/bluetooth/bluetooth_adapter_factory.cc
parent4ccfea6321a0aaf93dc92ced179f4ade6f4f28e5 (diff)
downloadchromium_src-ec9b06712a3cd52def1e8543178487a170fde46b.zip
chromium_src-ec9b06712a3cd52def1e8543178487a170fde46b.tar.gz
chromium_src-ec9b06712a3cd52def1e8543178487a170fde46b.tar.bz2
Created BluetoothAdapter::IsInitialized() and BluetoothAdapter::QueueAdapterCallback().
These methods are created to make sure the adapter is used only after it is initialized. For now both ChromeOS and Windows implementations return true for BluetoothAdpater::IsInitialized(), so nothing has been changed in terms of functionalities. BUG=135470 Review URL: https://chromiumcodereview.appspot.com/11959003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/bluetooth/bluetooth_adapter_factory.cc')
-rw-r--r--device/bluetooth/bluetooth_adapter_factory.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc
index 23bb07d3..e26f642 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -40,7 +40,7 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
// static
void BluetoothAdapterFactory::RunCallbackOnAdapterReady(
- const AdapterCallback& callback) {
+ const BluetoothAdapter::AdapterCallback& callback) {
if (!default_adapter.Get().get()) {
#if defined(OS_CHROMEOS)
chromeos::BluetoothAdapterChromeOs* new_adapter =
@@ -54,7 +54,11 @@ void BluetoothAdapterFactory::RunCallbackOnAdapterReady(
#endif
}
- callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get()));
+ if (default_adapter.Get()->IsInitialized()) {
+ callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get()));
+ } else {
+ default_adapter.Get()->QueueAdapterCallback(callback);
+ }
}
// static