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

Unified Diff: device/bluetooth/bluetooth_device.cc

Issue 2037173003: Notify the BluetoothAdapter::Observer when a bluetooth peripheral disconnects on Android and Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter.cc ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device.cc
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc
index 7d37591f5ea21483e15af7ab315436d3e8a6e70e..fa4322fcc17536f850ae286770d133e7585a904f 100644
--- a/device/bluetooth/bluetooth_device.cc
+++ b/device/bluetooth/bluetooth_device.cc
@@ -26,7 +26,9 @@ BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter)
services_data_(new base::DictionaryValue()) {}
BluetoothDevice::~BluetoothDevice() {
- DidDisconnectGatt();
+ for (BluetoothGattConnection* connection : gatt_connections_) {
+ connection->InvalidateConnectionReference();
+ }
}
BluetoothDevice::ConnectionInfo::ConnectionInfo()
@@ -335,6 +337,7 @@ void BluetoothDevice::DidConnectGatt() {
}
create_gatt_connection_success_callbacks_.clear();
create_gatt_connection_error_callbacks_.clear();
+ GetAdapter()->NotifyDeviceChanged(this);
}
void BluetoothDevice::DidFailToConnectGatt(ConnectErrorCode error) {
@@ -358,6 +361,7 @@ void BluetoothDevice::DidDisconnectGatt() {
connection->InvalidateConnectionReference();
}
gatt_connections_.clear();
+ GetAdapter()->NotifyDeviceChanged(this);
}
void BluetoothDevice::AddGattConnection(BluetoothGattConnection* connection) {
« no previous file with comments | « device/bluetooth/bluetooth_adapter.cc ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698