Index: components/proximity_auth/bluetooth_connection.cc |
diff --git a/components/proximity_auth/bluetooth_connection.cc b/components/proximity_auth/bluetooth_connection.cc |
index f06d52f6d260d05e435a8ebc3a091ecfe8425271..7adf8efad3dafab238a40bcf4192c02097b2f7ce 100644 |
--- a/components/proximity_auth/bluetooth_connection.cc |
+++ b/components/proximity_auth/bluetooth_connection.cc |
@@ -88,6 +88,16 @@ void BluetoothConnection::SendMessageImpl(scoped_ptr<WireMessage> message) { |
base::Bind(&BluetoothConnection::OnSendError, weak_this)); |
} |
+void BluetoothConnection::DeviceChanged(device::BluetoothAdapter* adapter, |
+ device::BluetoothDevice* device) { |
+ DCHECK_EQ(adapter, adapter_.get()); |
+ if (device->GetAddress() == remote_device().bluetooth_address && |
+ status() != DISCONNECTED && !device->IsConnected()) { |
+ PA_LOG(INFO) << "Device disconnected..."; |
+ Disconnect(); |
+ } |
+} |
+ |
void BluetoothConnection::DeviceRemoved(device::BluetoothAdapter* adapter, |
device::BluetoothDevice* device) { |
DCHECK_EQ(adapter, adapter_.get()); |
@@ -96,7 +106,8 @@ void BluetoothConnection::DeviceRemoved(device::BluetoothAdapter* adapter, |
DCHECK_NE(status(), DISCONNECTED); |
PA_LOG(INFO) << "Device disconnected..."; |
- Disconnect(); |
+ if (status() != DISCONNECTED) |
+ Disconnect(); |
} |
void BluetoothConnection::StartReceive() { |