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

Unified Diff: device/bluetooth/bluetooth_device_experimental_chromeos.cc

Issue 14199010: Bluetooth: call DeviceChanged observer method on IsConnecting() change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: device/bluetooth/bluetooth_device_experimental_chromeos.cc
diff --git a/device/bluetooth/bluetooth_device_experimental_chromeos.cc b/device/bluetooth/bluetooth_device_experimental_chromeos.cc
index 0f3e478149067c30e1252efede7191447f003163..2b3917afba5db75411106131f8492a14edaf86d2 100644
--- a/device/bluetooth/bluetooth_device_experimental_chromeos.cc
+++ b/device/bluetooth/bluetooth_device_experimental_chromeos.cc
@@ -138,7 +138,9 @@ void BluetoothDeviceExperimentalChromeOS::Connect(
BluetoothDevice::PairingDelegate* pairing_delegate,
const base::Closure& callback,
const ConnectErrorCallback& error_callback) {
- ++num_connecting_calls_;
+ if (num_connecting_calls_++ == 0)
+ adapter_->NotifyDeviceChanged(this);
+
VLOG(1) << object_path_.value() << ": Connecting, " << num_connecting_calls_
<< " in progress";
@@ -392,7 +394,9 @@ void BluetoothDeviceExperimentalChromeOS::ConnectInternal(
void BluetoothDeviceExperimentalChromeOS::OnConnect(
const base::Closure& callback) {
- --num_connecting_calls_;
+ if (--num_connecting_calls_ == 0)
+ adapter_->NotifyDeviceChanged(this);
+
DCHECK(num_connecting_calls_ >= 0);
VLOG(1) << object_path_.value() << ": Connected, " << num_connecting_calls_
<< " still in progress";
@@ -406,7 +410,9 @@ void BluetoothDeviceExperimentalChromeOS::OnConnectError(
const ConnectErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- --num_connecting_calls_;
+ if (--num_connecting_calls_ == 0)
+ adapter_->NotifyDeviceChanged(this);
+
DCHECK(num_connecting_calls_ >= 0);
LOG(WARNING) << object_path_.value() << ": Failed to connect device: "
<< error_name << ": " << error_message;
@@ -447,7 +453,9 @@ void BluetoothDeviceExperimentalChromeOS::OnRegisterAgentError(
const ConnectErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- --num_connecting_calls_;
+ if (--num_connecting_calls_ == 0)
+ adapter_->NotifyDeviceChanged(this);
+
DCHECK(num_connecting_calls_ >= 0);
LOG(WARNING) << object_path_.value() << ": Failed to register agent: "
<< error_name << ": " << error_message;
@@ -477,7 +485,9 @@ void BluetoothDeviceExperimentalChromeOS::OnPairError(
const ConnectErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- --num_connecting_calls_;
+ if (--num_connecting_calls_ == 0)
+ adapter_->NotifyDeviceChanged(this);
+
DCHECK(num_connecting_calls_ >= 0);
LOG(WARNING) << object_path_.value() << ": Failed to pair device: "
<< error_name << ": " << error_message;

Powered by Google App Engine
This is Rietveld 408576698