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

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

Issue 2026413002: bluetooth: Repopulate chooser with existing devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Created 4 years, 7 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 dc255a8e9afd601d84c9cb6cfe9969474fefb0eb..e0769c3f90940e3e58f63d2a15b40dc12b70faf3 100644
--- a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
+++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
@@ -326,13 +326,7 @@ void BluetoothDeviceChooserController::GetDevice(
return;
}
- // Populate the initial list of devices.
- VLOG(1) << "Populating " << adapter_->GetDevices().size()
- << " devices in chooser.";
- for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
- AddFilteredDevice(*device);
- }
-
+ PopulateFoundDevices();
if (!chooser_.get()) {
// If the dialog's closing, no need to do any of the rest of this.
return;
@@ -371,6 +365,14 @@ void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) {
}
}
+void BluetoothDeviceChooserController::PopulateFoundDevices() {
+ VLOG(1) << "Populating " << adapter_->GetDevices().size()
+ << " devices in chooser.";
+ for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
+ AddFilteredDevice(*device);
+ }
+}
+
void BluetoothDeviceChooserController::StartDeviceDiscovery() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -427,6 +429,11 @@ void BluetoothDeviceChooserController::OnBluetoothChooserEvent(
switch (event) {
case BluetoothChooser::Event::RESCAN:
+ PopulateFoundDevices();
+ if (!chooser_.get()) {
scheib 2016/06/01 20:57:42 Maybe move this check into StartDeviceDiscovery?
ortuno 2016/06/01 22:06:50 As mentioned offline, we shouldn't get into this s
+ // If the dialog's closing, no need to start a discovery session.
+ return;
+ }
StartDeviceDiscovery();
// No need to close the chooser so we return.
return;

Powered by Google App Engine
This is Rietveld 408576698