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

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2217573002: bluetooth: Only add new devices, connected devices and devices that changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-add-or-update
Patch Set: Fix typo Created 4 years, 4 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: content/browser/bluetooth/web_bluetooth_service_impl.cc
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index 974eb1db941a03eadbc6b82a7ff941677824002d..d559d92dfcf0d1153818804504edc618ab392873 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -228,8 +228,6 @@ void WebBluetoothServiceImpl::DeviceAdded(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (device_chooser_controller_.get()) {
- VLOG(1) << "Adding device to device chooser controller: "
- << device->GetAddress();
device_chooser_controller_->AddFilteredDevice(*device);
}
}
@@ -237,6 +235,11 @@ void WebBluetoothServiceImpl::DeviceAdded(device::BluetoothAdapter* adapter,
void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ if (device_chooser_controller_.get()) {
+ device_chooser_controller_->AddFilteredDevice(*device);
+ }
+
if (!device->IsGattConnected()) {
base::Optional<WebBluetoothDeviceId> device_id =
connected_devices_->CloseConnectionToDeviceWithAddress(
@@ -250,6 +253,10 @@ void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter,
void WebBluetoothServiceImpl::GattServicesDiscovered(
device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
+ if (device_chooser_controller_.get()) {
+ device_chooser_controller_->AddFilteredDevice(*device);
+ }
+
DCHECK_CURRENTLY_ON(BrowserThread::UI);
const std::string& device_address = device->GetAddress();
VLOG(1) << "Services discovered for device: " << device_address;

Powered by Google App Engine
This is Rietveld 408576698