Chromium Code Reviews| 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 7f877bf6f4caab43e47c388910232fd4f8e3417c..938aa7414d74e84d35c6d6d1c4cbe2ddc35ab619 100644 |
| --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
| +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc |
| @@ -7,6 +7,7 @@ |
| #include <algorithm> |
| #include "base/logging.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/net/referrer.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| @@ -15,12 +16,13 @@ |
| #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| #include "chrome/common/url_constants.h" |
| #include "chrome/grit/generated_resources.h" |
| -#include "content/browser/bluetooth/bluetooth_metrics.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "url/gurl.h" |
| namespace { |
| +enum class BluetoothChooserInteractionType { VALID = 0, INVALID = 1, COUNT }; |
| + |
| Browser* GetBrowser() { |
| chrome::ScopedTabbedBrowserDisplayer browser_displayer( |
| ProfileManager::GetActiveUserProfile()); |
| @@ -28,6 +30,15 @@ Browser* GetBrowser() { |
| return browser_displayer.browser(); |
| } |
| +void RecordInteractionWithChooser(bool has_null_handler) { |
| + UMA_HISTOGRAM_ENUMERATION( |
|
Ilya Sherman
2016/08/26 00:17:44
nit: UMA_HISTOGRAM_BOOLEAN probably is the best ch
ortuno
2016/08/26 16:14:36
Done.
|
| + "Bluetooth.Web.ChooserInteraction", |
| + static_cast<int>(has_null_handler |
| + ? BluetoothChooserInteractionType::INVALID |
| + : BluetoothChooserInteractionType::VALID), |
| + static_cast<int>(BluetoothChooserInteractionType::COUNT)); |
| +} |
| + |
| } // namespace |
| BluetoothChooserController::BluetoothChooserController( |
| @@ -78,6 +89,7 @@ base::string16 BluetoothChooserController::GetOption(size_t index) const { |
| } |
| void BluetoothChooserController::RefreshOptions() { |
| + RecordInteractionWithChooser(event_handler_.is_null()); |
| if (event_handler_.is_null()) |
| return; |
| ClearAllDevices(); |
| @@ -89,10 +101,8 @@ base::string16 BluetoothChooserController::GetStatus() const { |
| } |
| void BluetoothChooserController::Select(size_t index) { |
| + RecordInteractionWithChooser(event_handler_.is_null()); |
| if (event_handler_.is_null()) { |
| - content::RecordRequestDeviceOutcome( |
| - content::UMARequestDeviceOutcome:: |
| - BLUETOOTH_CHOOSER_EVENT_HANDLER_INVALID); |
| return; |
| } |
| DCHECK_LT(index, devices_.size()); |
| @@ -101,6 +111,7 @@ void BluetoothChooserController::Select(size_t index) { |
| } |
| void BluetoothChooserController::Cancel() { |
| + RecordInteractionWithChooser(event_handler_.is_null()); |
| if (event_handler_.is_null()) |
| return; |
| event_handler_.Run(content::BluetoothChooser::Event::CANCELLED, |
| @@ -108,6 +119,7 @@ void BluetoothChooserController::Cancel() { |
| } |
| void BluetoothChooserController::Close() { |
| + RecordInteractionWithChooser(event_handler_.is_null()); |
| if (event_handler_.is_null()) |
| return; |
| event_handler_.Run(content::BluetoothChooser::Event::CANCELLED, |