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

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: Fixed unit test for ItemChooserDialog 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 204c5dc6e436a99a62a04d611a393b2a855d8609..acc3a2a6712711f18f38d9905b936b97bb00478d 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -1286,13 +1286,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.
@@ -1353,6 +1347,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;
@@ -1707,4 +1702,20 @@ bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance(
.outcome != CacheQueryOutcome::BAD_RENDERER;
}
+void BluetoothDispatcherHost::PopulateWithExistingDevices(
+ RequestDeviceSession* session,
+ int chooser_id) {
+#if defined(OS_ANDROID)
scheib 2016/04/07 22:05:02 I'm concerned about this being platform specific.
+ adapter_->RemoveTimedOutDevices();
+#endif // defined(OS_ANDROID)
+
+ // 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);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698