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; |