Chromium Code Reviews| 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; |