| 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 f69fc34e1081e0c7524371a3de5f3fae7a047132..7aea34975d296b4dcf4985bd0eaef309d509dda2 100644
|
| --- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
|
| @@ -11,15 +11,17 @@
|
| #include "base/string_number_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
|
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_factory.h"
|
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_device.h"
|
| #include "content/public/browser/web_ui.h"
|
| +#include "device/bluetooth/bluetooth_adapter.h"
|
| +#include "device/bluetooth/bluetooth_adapter_factory.h"
|
| +#include "device/bluetooth/bluetooth_device.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
|
|
| +using bluetooth::BluetoothAdapter;
|
| +
|
| namespace {
|
|
|
| // |UpdateDeviceCallback| takes a variable length list as an argument. The
|
| @@ -124,8 +126,9 @@ void BluetoothOptionsHandler::GetLocalizedValues(
|
|
|
| // TODO(kevers): Reorder methods to match ordering in the header file.
|
|
|
| -void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter,
|
| - bool present) {
|
| +void BluetoothOptionsHandler::AdapterPresentChanged(
|
| + bluetooth::BluetoothAdapter* adapter,
|
| + bool present) {
|
| DCHECK(adapter == adapter_.get());
|
| if (present) {
|
| web_ui()->CallJavascriptFunction(
|
| @@ -140,8 +143,9 @@ void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter,
|
| }
|
| }
|
|
|
| -void BluetoothOptionsHandler::AdapterPoweredChanged(BluetoothAdapter* adapter,
|
| - bool powered) {
|
| +void BluetoothOptionsHandler::AdapterPoweredChanged(
|
| + bluetooth::BluetoothAdapter* adapter,
|
| + bool powered) {
|
| DCHECK(adapter == adapter_.get());
|
| base::FundamentalValue checked(powered);
|
| web_ui()->CallJavascriptFunction(
|
| @@ -167,7 +171,8 @@ void BluetoothOptionsHandler::RegisterMessages() {
|
| }
|
|
|
| void BluetoothOptionsHandler::InitializeHandler() {
|
| - adapter_ = BluetoothAdapterFactory::DefaultAdapter();
|
| + adapter_ = bluetooth::BluetoothAdapterFactory::DefaultAdapter();
|
| + DCHECK(adapter_.get());
|
| adapter_->AddObserver(this);
|
| }
|
|
|
| @@ -216,7 +221,7 @@ void BluetoothOptionsHandler::UpdateDeviceCallback(
|
| std::string address;
|
| args->GetString(kUpdateDeviceAddressIndex, &address);
|
|
|
| - BluetoothDevice* device = adapter_->GetDevice(address);
|
| + bluetooth::BluetoothDevice* device = adapter_->GetDevice(address);
|
| if (!device)
|
| return;
|
|
|
| @@ -332,7 +337,7 @@ void BluetoothOptionsHandler::GetPairedDevicesCallback(
|
| }
|
|
|
| void BluetoothOptionsHandler::SendDeviceNotification(
|
| - const BluetoothDevice* device,
|
| + const bluetooth::BluetoothDevice* device,
|
| base::DictionaryValue* params) {
|
| base::DictionaryValue js_properties;
|
| js_properties.SetString("name", device->GetName());
|
| @@ -348,36 +353,41 @@ void BluetoothOptionsHandler::SendDeviceNotification(
|
| js_properties);
|
| }
|
|
|
| -void BluetoothOptionsHandler::RequestPinCode(BluetoothDevice* device) {
|
| +void BluetoothOptionsHandler::RequestPinCode(
|
| + bluetooth::BluetoothDevice* device) {
|
| DictionaryValue params;
|
| params.SetString("pairing", kEnterPinCode);
|
| SendDeviceNotification(device, ¶ms);
|
| }
|
|
|
| -void BluetoothOptionsHandler::RequestPasskey(BluetoothDevice* device) {
|
| +void BluetoothOptionsHandler::RequestPasskey(
|
| + bluetooth::BluetoothDevice* device) {
|
| DictionaryValue params;
|
| params.SetString("pairing", kEnterPasskey);
|
| SendDeviceNotification(device, ¶ms);
|
| }
|
|
|
| -void BluetoothOptionsHandler::DisplayPinCode(BluetoothDevice* device,
|
| - const std::string& pincode) {
|
| +void BluetoothOptionsHandler::DisplayPinCode(
|
| + bluetooth::BluetoothDevice* device,
|
| + const std::string& pincode) {
|
| DictionaryValue params;
|
| params.SetString("pairing", kRemotePinCode);
|
| params.SetString("pincode", pincode);
|
| SendDeviceNotification(device, ¶ms);
|
| }
|
|
|
| -void BluetoothOptionsHandler::DisplayPasskey(BluetoothDevice* device,
|
| - uint32 passkey) {
|
| +void BluetoothOptionsHandler::DisplayPasskey(
|
| + bluetooth::BluetoothDevice* device,
|
| + uint32 passkey) {
|
| DictionaryValue params;
|
| params.SetString("pairing", kRemotePasskey);
|
| params.SetInteger("passkey", passkey);
|
| SendDeviceNotification(device, ¶ms);
|
| }
|
|
|
| -void BluetoothOptionsHandler::ConfirmPasskey(BluetoothDevice* device,
|
| - uint32 passkey) {
|
| +void BluetoothOptionsHandler::ConfirmPasskey(
|
| + bluetooth::BluetoothDevice* device,
|
| + uint32 passkey) {
|
| DictionaryValue params;
|
| params.SetString("pairing", kConfirmPasskey);
|
| params.SetInteger("passkey", passkey);
|
| @@ -400,22 +410,25 @@ void BluetoothOptionsHandler::ReportError(
|
| properties);
|
| }
|
|
|
| -void BluetoothOptionsHandler::DeviceAdded(BluetoothAdapter* adapter,
|
| - BluetoothDevice* device) {
|
| +void BluetoothOptionsHandler::DeviceAdded(
|
| + bluetooth::BluetoothAdapter* adapter,
|
| + bluetooth::BluetoothDevice* device) {
|
| DCHECK(adapter == adapter_.get());
|
| DCHECK(device);
|
| SendDeviceNotification(device, NULL);
|
| }
|
|
|
| -void BluetoothOptionsHandler::DeviceChanged(BluetoothAdapter* adapter,
|
| - BluetoothDevice* device) {
|
| +void BluetoothOptionsHandler::DeviceChanged(
|
| + bluetooth::BluetoothAdapter* adapter,
|
| + bluetooth::BluetoothDevice* device) {
|
| DCHECK(adapter == adapter_.get());
|
| DCHECK(device);
|
| SendDeviceNotification(device, NULL);
|
| }
|
|
|
| -void BluetoothOptionsHandler::DeviceRemoved(BluetoothAdapter* adapter,
|
| - BluetoothDevice* device) {
|
| +void BluetoothOptionsHandler::DeviceRemoved(
|
| + bluetooth::BluetoothAdapter* adapter,
|
| + bluetooth::BluetoothDevice* device) {
|
| DCHECK(adapter == adapter_.get());
|
| DCHECK(device);
|
|
|
|
|