Commit 654a8f0c authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

[desktop-pwas] Add metrics for menu actions in the Hosted App Frame.

This CL adds the "HostedAppFrame.WrenchMenu.MenuAction" metric which
tracks which menu actions are being clicked from the hosted app browser
frame.

Bug: 785661
Change-Id: I4b6c349892615452ce8ed6ebc8b1c23e5f1a8a9e
Reviewed-on: https://chromium-review.googlesource.com/802838
Commit-Queue: calamity <calamity@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521273}
parent 73505ae3
......@@ -4,6 +4,7 @@
#include "chrome/browser/ui/extensions/hosted_app_menu_model.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/profiles/profile.h"
......@@ -31,3 +32,8 @@ void HostedAppMenuModel::Build() {
AddItemWithStringId(IDC_SITE_SETTINGS, IDS_SITE_SETTINGS);
AddItemWithStringId(IDC_APP_INFO, IDS_APP_CONTEXT_MENU_SHOW_INFO);
}
void HostedAppMenuModel::LogMenuAction(AppMenuAction action_id) {
UMA_HISTOGRAM_ENUMERATION("HostedAppFrame.WrenchMenu.MenuAction", action_id,
LIMIT_MENU_ACTION);
}
......@@ -17,6 +17,7 @@ class HostedAppMenuModel : public AppMenuModel {
private:
// AppMenuModel:
void Build() override;
void LogMenuAction(AppMenuAction action_id) override;
DISALLOW_COPY_AND_ASSIGN(HostedAppMenuModel);
};
......
......@@ -606,11 +606,6 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
}
}
void AppMenuModel::LogMenuAction(AppMenuAction action_id) {
UMA_HISTOGRAM_ENUMERATION("WrenchMenu.MenuAction", action_id,
LIMIT_MENU_ACTION);
}
bool AppMenuModel::IsCommandIdChecked(int command_id) const {
if (command_id == IDC_SHOW_BOOKMARK_BAR) {
return browser_->profile()->GetPrefs()->GetBoolean(
......@@ -690,6 +685,11 @@ void AppMenuModel::Observe(int type,
UpdateZoomControls();
}
void AppMenuModel::LogMenuAction(AppMenuAction action_id) {
UMA_HISTOGRAM_ENUMERATION("WrenchMenu.MenuAction", action_id,
LIMIT_MENU_ACTION);
}
// Note: When adding new menu items please place under an appropriate section.
// Menu is organised as follows:
// - Extension toolbar overflow.
......
......@@ -161,6 +161,9 @@ class AppMenuModel : public ui::SimpleMenuModel,
void UpdateZoomControls();
protected:
// Helper function to record the menu action in a UMA histogram.
virtual void LogMenuAction(AppMenuAction action_id);
// Builds the menu model, adding appropriate menu items.
virtual void Build();
......@@ -193,9 +196,6 @@ class AppMenuModel : public ui::SimpleMenuModel,
// took to select the command.
void LogMenuMetrics(int command_id);
// Helper function to record the menu action in a UMA histogram.
void LogMenuAction(AppMenuAction action_id);
// Time menu has been open. Used by LogMenuMetrics() to record the time
// to action when the user selects a menu item.
base::ElapsedTimer timer_;
......
......@@ -28379,6 +28379,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="HostedAppFrame.WrenchMenu.MenuAction" enum="WrenchMenuAction">
<owner>calamity@chromium.org</owner>
<summary>
Number of times that each menu item is clicked from the hosted app window
menu button.
</summary>
</histogram>
<histogram name="Hotword.AudioLoggingEnabled" enum="BooleanEnabled">
<obsolete>
Deprecated as of 10/2017. Feature removed with crbug/761426.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment