Index: chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc |
index c2df792f7e484e31ec0e9a5c7ce778c0d1c45f34..99ca95b5a0db9f366d62fc1c3016719d7d3ce5ce 100644 |
--- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc |
@@ -183,9 +183,9 @@ void BluetoothOptionsHandler::RegisterMessages() { |
} |
void BluetoothOptionsHandler::InitializeHandler() { |
- adapter_ = device::BluetoothAdapterFactory::DefaultAdapter(); |
- DCHECK(adapter_.get()); |
- adapter_->AddObserver(this); |
+ device::BluetoothAdapterFactory::RunCallbackOnAdapterReady( |
+ base::Bind(&BluetoothOptionsHandler::InitializeAdapter, |
+ weak_ptr_factory_.GetWeakPtr())); |
} |
void BluetoothOptionsHandler::InitializePage() { |
@@ -198,6 +198,13 @@ void BluetoothOptionsHandler::InitializePage() { |
"options.BluetoothOptions.updateDiscovery"); |
} |
+void BluetoothOptionsHandler::InitializeAdapter( |
+ scoped_refptr<device::BluetoothAdapter> adapter) { |
+ adapter_ = adapter; |
+ CHECK(adapter_); |
+ adapter_->AddObserver(this); |
+} |
+ |
void BluetoothOptionsHandler::EnableChangeCallback( |
const ListValue* args) { |
bool bluetooth_enabled; |