diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-22 21:57:37 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-22 21:57:37 +0000 |
commit | 60b4eda85802abcbb1c0a8469e7b1d13cfeb1d59 (patch) | |
tree | 9da689e067e4d1121737bf6e47a3f37755033a90 | |
parent | 84c1dd6455200d84b091aff150d467572510a116 (diff) | |
download | chromium_src-60b4eda85802abcbb1c0a8469e7b1d13cfeb1d59.zip chromium_src-60b4eda85802abcbb1c0a8469e7b1d13cfeb1d59.tar.gz chromium_src-60b4eda85802abcbb1c0a8469e7b1d13cfeb1d59.tar.bz2 |
Bluetooth: don't connect to unconnectable devices or disconnect
BUG=175640,233841
TEST=out/Debug/chrome --enable-experimental-bluetooth
Review URL: https://chromiumcodereview.appspot.com/14068004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195617 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/system/bluetooth/tray_bluetooth.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray_delegate.h | 4 | ||||
-rw-r--r-- | ash/system/tray/test_system_tray_delegate.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/test_system_tray_delegate.h | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/system/ash_system_tray_delegate.cc | 16 |
5 files changed, 10 insertions, 16 deletions
diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index 0015613..fd9099e 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc @@ -331,7 +331,7 @@ class BluetoothDetailedView : public TrayDetailsView, if (FoundDevice(device_id, connecting_devices_, NULL)) return; UpdateClickedDevice(device_id, sender); - delegate->ToggleBluetoothConnection(device_id); + delegate->ConnectToBluetoothDevice(device_id); } } diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index 82644f03f..144e41a 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -217,8 +217,8 @@ class SystemTrayDelegate { // Requests bluetooth stop discovering devices. virtual void BluetoothStopDiscovering() = 0; - // Toggles connection to a specific bluetooth device. - virtual void ToggleBluetoothConnection(const std::string& address) = 0; + // Connect to a specific bluetooth device. + virtual void ConnectToBluetoothDevice(const std::string& address) = 0; // Returns true if bluetooth adapter is discovering bluetooth devices. virtual bool IsBluetoothDiscovering() = 0; diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc index b02f208..81a0ec0 100644 --- a/ash/system/tray/test_system_tray_delegate.cc +++ b/ash/system/tray/test_system_tray_delegate.cc @@ -198,7 +198,7 @@ void TestSystemTrayDelegate::BluetoothStartDiscovering() { void TestSystemTrayDelegate::BluetoothStopDiscovering() { } -void TestSystemTrayDelegate::ToggleBluetoothConnection( +void TestSystemTrayDelegate::ConnectToBluetoothDevice( const std::string& address) { } diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h index a08b6ef..bbd1a24 100644 --- a/ash/system/tray/test_system_tray_delegate.h +++ b/ash/system/tray/test_system_tray_delegate.h @@ -59,7 +59,7 @@ class TestSystemTrayDelegate : public SystemTrayDelegate { virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* list) OVERRIDE; virtual void BluetoothStartDiscovering() OVERRIDE; virtual void BluetoothStopDiscovering() OVERRIDE; - virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE; + virtual void ConnectToBluetoothDevice(const std::string& address) OVERRIDE; virtual void GetCurrentIME(IMEInfo* info) OVERRIDE; virtual void GetAvailableIMEList(IMEInfoList* list) OVERRIDE; virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) OVERRIDE; diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 34b038d..1f64fcc 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -184,10 +184,6 @@ void BluetoothDiscoveryFailure() { // TODO(sad): Show an error bubble? } -void BluetoothDeviceDisconnectError() { - // TODO(sad): Do something? -} - void BluetoothSetDiscoveringError() { LOG(ERROR) << "BluetoothSetDiscovering failed."; } @@ -623,15 +619,13 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, base::Bind(&BluetoothSetDiscoveringError)); } - virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { + virtual void ConnectToBluetoothDevice(const std::string& address) OVERRIDE { device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); - if (!device || device->IsConnecting()) + if (!device || device->IsConnecting() || device->IsConnected()) return; - if (device->IsConnected()) { - device->Disconnect( - base::Bind(&base::DoNothing), - base::Bind(&BluetoothDeviceDisconnectError)); - } else if (device->IsPaired() || !device->IsPairable()) { + if (device->IsPaired() && !device->IsConnectable()) + return; + if (device->IsPaired() || !device->IsPairable()) { device->Connect( NULL, base::Bind(&base::DoNothing), |