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

Unified Diff: content/browser/bluetooth/bluetooth_device_chooser_controller.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/bluetooth_device_chooser_controller.cc
diff --git a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
index 7986f72a8ceb1c9035b8cffcc8b4dffa1b3e5e3a..b2d8792f0c4a5fd5ddccd1b9594b719793ec41df 100644
--- a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
+++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
@@ -321,7 +321,7 @@ void BluetoothDeviceChooserController::GetDevice(
return;
}
- PopulateFoundDevices();
+ PopulateConnectedDevices();
if (!chooser_.get()) {
// If the dialog's closing, no need to do any of the rest of this.
return;
@@ -339,7 +339,6 @@ void BluetoothDeviceChooserController::GetDevice(
void BluetoothDeviceChooserController::AddFilteredDevice(
const device::BluetoothDevice& device) {
if (chooser_.get() && MatchesFilters(device, options_->filters)) {
- VLOG(1) << "Adding device to chooser: " << device.GetAddress();
chooser_->AddOrUpdateDevice(
device.GetAddress(),
// TODO(https://crbug.com/634366): Update device's name when necessary.
@@ -375,11 +374,11 @@ void BluetoothDeviceChooserController::SetTestScanDurationForTesting() {
BluetoothDeviceChooserController::use_test_scan_duration_ = true;
}
-void BluetoothDeviceChooserController::PopulateFoundDevices() {
- VLOG(1) << "Populating " << adapter_->GetDevices().size()
- << " devices in chooser.";
+void BluetoothDeviceChooserController::PopulateConnectedDevices() {
for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
- AddFilteredDevice(*device);
+ if (device->IsGattConnected()) {
+ AddFilteredDevice(*device);
+ }
}
}
@@ -439,7 +438,7 @@ void BluetoothDeviceChooserController::OnBluetoothChooserEvent(
switch (event) {
case BluetoothChooser::Event::RESCAN:
- PopulateFoundDevices();
+ PopulateConnectedDevices();
DCHECK(chooser_);
StartDeviceDiscovery();
// No need to close the chooser so we return.

Powered by Google App Engine
This is Rietveld 408576698