Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc

Issue 11819007: Changed DefaultAdapter to RunCallbackOnAdapterReady function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created IsBluetoothSupported in BluetoothEventRouter to fix browser_tests. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698