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

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

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added #include <string> into bluetooth_adapter_dbus.cc. Created 8 years, 3 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 b6ca46a5dfc1176241089a593432238cf689df18..a1e12bc9e75158468261e5a578ab9f15d53cc8ac 100644
--- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
@@ -11,8 +11,8 @@
#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_device.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.h"
#include "content/public/browser/web_ui.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -123,8 +123,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(
+ BluetoothAdapterDBus* adapter,
+ bool present) {
DCHECK(adapter == adapter_.get());
if (present) {
web_ui()->CallJavascriptFunction(
@@ -139,8 +140,9 @@ void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter,
}
}
-void BluetoothOptionsHandler::AdapterPoweredChanged(BluetoothAdapter* adapter,
- bool powered) {
+void BluetoothOptionsHandler::AdapterPoweredChanged(
+ BluetoothAdapterDBus* adapter,
+ bool powered) {
DCHECK(adapter == adapter_.get());
base::FundamentalValue checked(powered);
web_ui()->CallJavascriptFunction(
@@ -166,7 +168,7 @@ void BluetoothOptionsHandler::RegisterMessages() {
}
void BluetoothOptionsHandler::InitializeHandler() {
- adapter_ = BluetoothAdapter::DefaultAdapter();
+ adapter_ = BluetoothAdapterDBus::DefaultAdapter();
adapter_->AddObserver(this);
}
@@ -215,7 +217,8 @@ void BluetoothOptionsHandler::UpdateDeviceCallback(
std::string address;
args->GetString(kUpdateDeviceAddressIndex, &address);
- BluetoothDevice* device = adapter_->GetDevice(address);
+ BluetoothDeviceDBus* device = static_cast<BluetoothDeviceDBus *>(
+ adapter_->GetDevice(address));
if (!device)
return;
@@ -323,15 +326,15 @@ void BluetoothOptionsHandler::StopDiscoveryError() {
void BluetoothOptionsHandler::GetPairedDevicesCallback(
const ListValue* args) {
- BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
+ BluetoothAdapterDBus::DeviceList devices = adapter_->GetDevices();
- for (BluetoothAdapter::DeviceList::iterator iter = devices.begin();
+ for (BluetoothAdapterDBus::DeviceList::iterator iter = devices.begin();
iter != devices.end(); ++iter)
SendDeviceNotification(*iter, NULL);
}
void BluetoothOptionsHandler::SendDeviceNotification(
- const BluetoothDevice* device,
+ const BluetoothDeviceInterface* device,
base::DictionaryValue* params) {
base::DictionaryValue js_properties;
js_properties.SetString("name", device->GetName());
@@ -347,19 +350,19 @@ void BluetoothOptionsHandler::SendDeviceNotification(
js_properties);
}
-void BluetoothOptionsHandler::RequestPinCode(BluetoothDevice* device) {
+void BluetoothOptionsHandler::RequestPinCode(BluetoothDeviceDBus* device) {
DictionaryValue params;
params.SetString("pairing", kEnterPinCode);
SendDeviceNotification(device, &params);
}
-void BluetoothOptionsHandler::RequestPasskey(BluetoothDevice* device) {
+void BluetoothOptionsHandler::RequestPasskey(BluetoothDeviceDBus* device) {
DictionaryValue params;
params.SetString("pairing", kEnterPasskey);
SendDeviceNotification(device, &params);
}
-void BluetoothOptionsHandler::DisplayPinCode(BluetoothDevice* device,
+void BluetoothOptionsHandler::DisplayPinCode(BluetoothDeviceDBus* device,
const std::string& pincode) {
DictionaryValue params;
params.SetString("pairing", kRemotePinCode);
@@ -367,7 +370,7 @@ void BluetoothOptionsHandler::DisplayPinCode(BluetoothDevice* device,
SendDeviceNotification(device, &params);
}
-void BluetoothOptionsHandler::DisplayPasskey(BluetoothDevice* device,
+void BluetoothOptionsHandler::DisplayPasskey(BluetoothDeviceDBus* device,
uint32 passkey) {
DictionaryValue params;
params.SetString("pairing", kRemotePasskey);
@@ -375,7 +378,7 @@ void BluetoothOptionsHandler::DisplayPasskey(BluetoothDevice* device,
SendDeviceNotification(device, &params);
}
-void BluetoothOptionsHandler::ConfirmPasskey(BluetoothDevice* device,
+void BluetoothOptionsHandler::ConfirmPasskey(BluetoothDeviceDBus* device,
uint32 passkey) {
DictionaryValue params;
params.SetString("pairing", kConfirmPasskey);
@@ -399,22 +402,22 @@ void BluetoothOptionsHandler::ReportError(
properties);
}
-void BluetoothOptionsHandler::DeviceAdded(BluetoothAdapter* adapter,
- BluetoothDevice* device) {
+void BluetoothOptionsHandler::DeviceAdded(BluetoothAdapterDBus* adapter,
+ BluetoothDeviceDBus* device) {
DCHECK(adapter == adapter_.get());
DCHECK(device);
SendDeviceNotification(device, NULL);
}
-void BluetoothOptionsHandler::DeviceChanged(BluetoothAdapter* adapter,
- BluetoothDevice* device) {
+void BluetoothOptionsHandler::DeviceChanged(BluetoothAdapterDBus* adapter,
+ BluetoothDeviceDBus* device) {
DCHECK(adapter == adapter_.get());
DCHECK(device);
SendDeviceNotification(device, NULL);
}
-void BluetoothOptionsHandler::DeviceRemoved(BluetoothAdapter* adapter,
- BluetoothDevice* device) {
+void BluetoothOptionsHandler::DeviceRemoved(BluetoothAdapterDBus* adapter,
+ BluetoothDeviceDBus* device) {
DCHECK(adapter == adapter_.get());
DCHECK(device);

Powered by Google App Engine
This is Rietveld 408576698