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

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

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned adapter_callbacks to a lazy instance. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 base::Unretained(this))); 176 base::Unretained(this)));
177 web_ui()->RegisterMessageCallback("stopBluetoothDeviceDiscovery", 177 web_ui()->RegisterMessageCallback("stopBluetoothDeviceDiscovery",
178 base::Bind(&BluetoothOptionsHandler::StopDiscoveryCallback, 178 base::Bind(&BluetoothOptionsHandler::StopDiscoveryCallback,
179 base::Unretained(this))); 179 base::Unretained(this)));
180 web_ui()->RegisterMessageCallback("getPairedBluetoothDevices", 180 web_ui()->RegisterMessageCallback("getPairedBluetoothDevices",
181 base::Bind(&BluetoothOptionsHandler::GetPairedDevicesCallback, 181 base::Bind(&BluetoothOptionsHandler::GetPairedDevicesCallback,
182 base::Unretained(this))); 182 base::Unretained(this)));
183 } 183 }
184 184
185 void BluetoothOptionsHandler::InitializeHandler() { 185 void BluetoothOptionsHandler::InitializeHandler() {
186 device::BluetoothAdapterFactory::RunCallbackOnAdapterReady( 186 device::BluetoothAdapterFactory::GetAdapter(
187 base::Bind(&BluetoothOptionsHandler::InitializeAdapter, 187 base::Bind(&BluetoothOptionsHandler::InitializeAdapter,
188 weak_ptr_factory_.GetWeakPtr())); 188 weak_ptr_factory_.GetWeakPtr()));
189 } 189 }
190 190
191 void BluetoothOptionsHandler::InitializePage() { 191 void BluetoothOptionsHandler::InitializePage() {
192 // Show or hide the bluetooth settings and update the checkbox based 192 // Show or hide the bluetooth settings and update the checkbox based
193 // on the current present/powered state. 193 // on the current present/powered state.
194 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); 194 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent());
195 // Automatically start device discovery if the "Add Bluetooth Device" 195 // Automatically start device discovery if the "Add Bluetooth Device"
196 // overlay is visible. 196 // overlay is visible.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 DCHECK(device); 476 DCHECK(device);
477 477
478 base::StringValue address(device->address()); 478 base::StringValue address(device->address());
479 web_ui()->CallJavascriptFunction( 479 web_ui()->CallJavascriptFunction(
480 "options.BrowserOptions.removeBluetoothDevice", 480 "options.BrowserOptions.removeBluetoothDevice",
481 address); 481 address);
482 } 482 }
483 483
484 } // namespace options 484 } // namespace options
485 } // namespace chromeos 485 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698