diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 03:32:26 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 03:32:26 +0000 |
commit | 320447d72fca8cbcd8ddef035f47e554a175a32c (patch) | |
tree | 5847508989e52d651ae1d5f92c33540aecf070ed /chrome/browser/ui/webui | |
parent | c308f512b3dd5008cf921d575ae669e340815ddf (diff) | |
download | chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.zip chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.tar.gz chromium_src-320447d72fca8cbcd8ddef035f47e554a175a32c.tar.bz2 |
Bluetooth: clean up Bluetooth classes
The abstract BluetoothDevice class has a few problems inherited from
its origin as a ChromeOS-specific class split between implementation
and platform-specific components.
Clean those problems up, specifically:
- replace bluetooth_class_, name_ and address_ non-abstract members
with getter functions that the platform should implement.
- also make IsConnected(), IsConnectable() and IsConnecting()
abstract functions rather than providing an implementation
- remove IsVisible() which was a CrOS-specific hack
- remove IsBonded(), use IsPaired() instead
- remove service_uuids_ non-abstract member; make GetServices return
a copy of the list to allow implementations to fetch it on demand
BluetoothDevice retains implementations for GetName(), GetDisplayType()
and ProvidesServiceWithUUID() since those can be implemented entirely
using platform-provided information functions and would be identical
in each platform.
Also rename BluetoothAdapter::address() and BluetoothAdapter::name() to
GetAddress() and GetName() to match since they are also pure virtual.
BUG=none
TEST=device_unittests, browser_tests, unit_tests
Review URL: https://chromiumcodereview.appspot.com/13416005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui')
-rw-r--r-- | chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc | 11 |
1 files changed, 5 insertions, 6 deletions
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 4bed9b8..f994843 100644 --- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc @@ -296,7 +296,7 @@ void BluetoothOptionsHandler::UpdateDeviceCallback( base::Bind(&base::DoNothing), base::Bind(&BluetoothOptionsHandler::ConnectError, weak_ptr_factory_.GetWeakPtr(), - device->address())); + device->GetAddress())); } } else if (command == kCancelCommand) { // Cancel pairing. @@ -317,13 +317,13 @@ void BluetoothOptionsHandler::UpdateDeviceCallback( base::Bind(&base::DoNothing), base::Bind(&BluetoothOptionsHandler::DisconnectError, weak_ptr_factory_.GetWeakPtr(), - device->address())); + device->GetAddress())); } else if (command == kForgetCommand) { // Disconnect from device and delete pairing information. VLOG(1) << "Forget device: " << address; device->Forget(base::Bind(&BluetoothOptionsHandler::ForgetError, weak_ptr_factory_.GetWeakPtr(), - device->address())); + device->GetAddress())); } else { LOG(WARNING) << "Unknown updateBluetoothDevice command: " << command; } @@ -406,9 +406,8 @@ void BluetoothOptionsHandler::SendDeviceNotification( base::DictionaryValue* params) { base::DictionaryValue js_properties; js_properties.SetString("name", device->GetName()); - js_properties.SetString("address", device->address()); + js_properties.SetString("address", device->GetAddress()); js_properties.SetBoolean("paired", device->IsPaired()); - js_properties.SetBoolean("bonded", device->IsBonded()); js_properties.SetBoolean("connected", device->IsConnected()); js_properties.SetBoolean("connectable", device->IsConnectable()); if (params) @@ -489,7 +488,7 @@ void BluetoothOptionsHandler::DeviceRemoved(device::BluetoothAdapter* adapter, DCHECK(adapter == adapter_.get()); DCHECK(device); - base::StringValue address(device->address()); + base::StringValue address(device->GetAddress()); web_ui()->CallJavascriptFunction( "options.BrowserOptions.removeBluetoothDevice", address); |