Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: ash/system/chromeos/tray_display.cc

Issue 2130923002: Added UMA metrics for display settings UI in the status area. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into uma_display Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/metrics/user_metrics_recorder.cc ('k') | base/metrics/user_metrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/tray_display.cc
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index 36790db983ed1ae8bc8ca5137b5d27f8430c5f2c..5873e54c649582f272547d25c0905603c1d9c004 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -8,6 +8,7 @@
#include <utility>
#include <vector>
+#include "ash/common/metrics/user_metrics_action.h"
#include "ash/common/system/chromeos/devicetype_utils.h"
#include "ash/common/system/system_notifier.h"
#include "ash/common/system/tray/actionable_view.h"
@@ -111,13 +112,14 @@ base::string16 GetAllDisplayInfo() {
return base::JoinString(lines, base::ASCIIToUTF16("\n"));
}
-void OpenSettings() {
+// Attempts to open the display settings, returns true if successful.
+bool OpenSettings() {
// switch is intentionally introduced without default, to cause an error when
// a new type of login status is introduced.
switch (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus()) {
case LoginStatus::NOT_LOGGED_IN:
case LoginStatus::LOCKED:
- return;
+ return false;
case LoginStatus::USER:
case LoginStatus::OWNER:
@@ -126,8 +128,22 @@ void OpenSettings() {
case LoginStatus::SUPERVISED:
case LoginStatus::KIOSK_APP:
SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
- if (delegate->ShouldShowSettings())
+ if (delegate->ShouldShowSettings()) {
delegate->ShowDisplaySettings();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Callback to handle a user selecting the notification view.
+void OpenSettingsFromNotification() {
+ WmShell::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_DISPLAY_NOTIFICATION_SELECTED);
+ if (OpenSettings()) {
+ WmShell::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_DISPLAY_NOTIFICATION_SHOW_SETTINGS);
}
}
@@ -279,7 +295,12 @@ class DisplayView : public ActionableView {
// Overridden from ActionableView.
bool PerformAction(const ui::Event& event) override {
- OpenSettings();
+ WmShell::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_DISPLAY_DEFAULT_SELECTED);
+ if (OpenSettings()) {
+ WmShell::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_DISPLAY_DEFAULT_SHOW_SETTINGS);
+ }
return true;
}
@@ -404,8 +425,10 @@ void TrayDisplay::CreateOrUpdateNotification(
system_notifier::kNotifierDisplay),
message_center::RichNotificationData(),
new message_center::HandleNotificationClickedDelegate(
- base::Bind(&OpenSettings))));
+ base::Bind(&OpenSettingsFromNotification))));
+ WmShell::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_DISPLAY_NOTIFICATION_CREATED);
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
« no previous file with comments | « ash/metrics/user_metrics_recorder.cc ('k') | base/metrics/user_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698