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