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 f658f69fe277d266ea952c9ce1091d047698ca27..5333142525a9b496b071d4137c02b4956ca01736 100644 |
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
@@ -32,6 +32,11 @@ void RecordInteractionWithChooser(bool has_null_handler) { |
UMA_HISTOGRAM_BOOLEAN("Bluetooth.Web.ChooserInteraction", has_null_handler); |
} |
+void RecordScanningDuration(const base::TimeDelta& duration) { |
+ UMA_HISTOGRAM_MEDIUM_TIMES("Bluetooth.Web.RequestDevice.ScanningDuration", |
scheib
2016/11/17 05:19:59
"UMA_HISTOGRAM_LONG_TIMES" instead I think. We've
juncai
2016/11/17 21:15:30
Done.
|
+ duration); |
+} |
+ |
} // namespace |
BluetoothChooserController::BluetoothChooserController( |
@@ -169,6 +174,7 @@ void BluetoothChooserController::OnDiscoveryStateChanged( |
content::BluetoothChooser::DiscoveryState state) { |
switch (state) { |
case content::BluetoothChooser::DiscoveryState::DISCOVERING: |
+ scanning_start_time_ = base::TimeTicks::Now(); |
status_text_ = |
l10n_util::GetStringUTF16(IDS_BLUETOOTH_DEVICE_CHOOSER_SCANNING); |
if (view()) { |
@@ -195,6 +201,11 @@ void BluetoothChooserController::AddOrUpdateDevice( |
bool is_gatt_connected, |
bool is_paired, |
int signal_strength_level) { |
+ if (scanning_start_time_) { |
scheib
2016/11/17 05:19:59
Why is the scanning start time reset when a new de
juncai
2016/11/17 21:15:30
Done.
|
+ RecordScanningDuration(base::TimeTicks::Now() - |
+ scanning_start_time_.value()); |
+ scanning_start_time_.reset(); |
+ } |
auto name_it = device_id_to_name_map_.find(device_id); |
if (name_it != device_id_to_name_map_.end()) { |
if (should_update_name) { |