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

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

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master Created 4 years, 8 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_dispatcher_host.cc
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index 209a3517c16f68cd58a7a197f62c1781d132a828..35b395f50f9e1e41117184f0ccaae0470a228ab1 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -757,13 +757,7 @@ void BluetoothDispatcherHost::OnRequestDeviceImpl(
return;
}
- // Populate the initial list of devices.
- VLOG(1) << "Populating " << adapter_->GetDevices().size()
- << " devices in chooser " << chooser_id;
- for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
- VLOG(1) << "\t" << device->GetAddress();
- session->AddFilteredDevice(*device);
- }
+ PopulateWithExistingDevices(session, chooser_id);
if (!session->chooser) {
// If the dialog's closing, no need to do any of the rest of this.
@@ -824,6 +818,7 @@ void BluetoothDispatcherHost::OnBluetoothChooserEvent(
<< ") from a closed chooser.";
switch (event) {
case BluetoothChooser::Event::RESCAN:
+ PopulateWithExistingDevices(session, chooser_id);
StartDeviceDiscovery(session, chooser_id);
// No need to close the chooser so we return.
return;
@@ -1013,4 +1008,16 @@ url::Origin BluetoothDispatcherHost::GetOrigin(int frame_routing_id) {
->GetLastCommittedOrigin();
}
+void BluetoothDispatcherHost::PopulateWithExistingDevices(
+ RequestDeviceSession* session,
+ int chooser_id) {
+ // Populate the initial list of devices.
scheib 2016/05/06 00:41:50 This comment not needed now that the code block is
+ VLOG(1) << "Populating " << adapter_->GetDevices().size()
+ << " devices in chooser " << chooser_id;
+ for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
+ VLOG(1) << "\t" << device->GetAddress();
+ session->AddFilteredDevice(*device);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698