Index: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
index 13f85f20d01d0b085d6feee15fb0e7b9cce38d34..089bdb81bc57d23a259d70e43f4a5c5e5fdc0bd6 100644 |
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
@@ -32,15 +32,24 @@ void RecordInteractionWithChooser(bool has_null_handler) { |
UMA_HISTOGRAM_BOOLEAN("Bluetooth.Web.ChooserInteraction", has_null_handler); |
} |
+void RecordNumOfDevices(size_t num_of_devices) { |
+ UMA_HISTOGRAM_SPARSE_SLOWLY( |
+ "Bluetooth.Web.RequestDevice." |
+ "NumOfDevicesInChooserWhenNotAcceptingAllDevices", |
+ num_of_devices); |
+} |
+ |
} // namespace |
BluetoothChooserController::BluetoothChooserController( |
content::RenderFrameHost* owner, |
- const content::BluetoothChooser::EventHandler& event_handler) |
+ const content::BluetoothChooser::EventHandler& event_handler, |
+ bool accept_all_devices) |
: ChooserController(owner, |
IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_ORIGIN, |
IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_EXTENSION_NAME), |
- event_handler_(event_handler) {} |
+ event_handler_(event_handler), |
+ accept_all_devices_(accept_all_devices) {} |
BluetoothChooserController::~BluetoothChooserController() {} |
@@ -115,6 +124,8 @@ void BluetoothChooserController::Select(const std::vector<size_t>& indices) { |
return; |
} |
DCHECK_LT(index, devices_.size()); |
+ if (!accept_all_devices_) |
scheib
2016/12/16 06:36:16
Perhaps move the if check to the Record method?
juncai
2016/12/16 18:34:40
Done.
|
+ RecordNumOfDevices(devices_.size()); |
event_handler_.Run(content::BluetoothChooser::Event::SELECTED, |
devices_[index].id); |
} |