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 6a0e22a8eb8277c5a6bad3e9f4ddd816aae8fc9b..65c13c29b780001a0f538ca7e43567b314c3f0da 100644 |
| --- a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc |
| +++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc |
| @@ -429,8 +429,10 @@ void BluetoothDeviceChooserController::AddFilteredDevice( |
| MatchesFilters(device_name ? &device_name.value() : nullptr, |
| device.GetUUIDs(), options_->filters)) { |
| base::Optional<int8_t> rssi = device.GetInquiryRSSI(); |
| + std::string device_id = device.GetAddress(); |
| + device_ids_.insert(device_id); |
|
Reilly Grant (use Gerrit)
2016/12/19 20:52:17
I was going to note that you should call device_id
juncai
2016/12/19 22:16:13
Thanks! I filed a bug for it:
https://bugs.chromiu
|
| chooser_->AddOrUpdateDevice( |
| - device.GetAddress(), !!device.GetName() /* should_update_name */, |
| + device_id, !!device.GetName() /* should_update_name */, |
| device.GetNameForDisplay(), device.IsGattConnected(), |
| web_bluetooth_service_->IsDevicePaired(device.GetAddress()), |
| rssi ? CalculateSignalStrengthLevel(rssi.value()) : -1); |
| @@ -501,6 +503,8 @@ void BluetoothDeviceChooserController::StartDeviceDiscovery() { |
| return; |
| } |
| + device_ids_.clear(); |
| + |
| scanning_start_time_ = base::TimeTicks::Now(); |
| chooser_->ShowDiscoveryState(BluetoothChooser::DiscoveryState::DISCOVERING); |
| @@ -588,6 +592,7 @@ void BluetoothDeviceChooserController::OnBluetoothChooserEvent( |
| PostErrorCallback(blink::mojom::WebBluetoothResult::CHOOSER_CANCELLED); |
| break; |
| case BluetoothChooser::Event::SELECTED: |
| + RecordNumOfDevices(options_->accept_all_devices, device_ids_.size()); |
| // RecordRequestDeviceOutcome is called in the callback, because the |
| // device may have vanished. |
| PostSuccessCallback(device_address); |