summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/toolbar/wrench_menu_model.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/toolbar/wrench_menu_model.h')
-rw-r--r--chrome/browser/ui/toolbar/wrench_menu_model.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.h b/chrome/browser/ui/toolbar/wrench_menu_model.h
index ff787c8..4b9cefe 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.h
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.h
@@ -7,6 +7,8 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "base/timer/elapsed_timer.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_observer.h"
@@ -24,6 +26,54 @@ namespace {
class MockWrenchMenuModel;
} // namespace
+enum WrenchMenuAction {
+ MENU_ACTION_NEW_TAB = 0,
+ MENU_ACTION_NEW_WINDOW,
+ MENU_ACTION_NEW_INCOGNITO_WINDOW,
+ MENU_ACTION_SHOW_BOOKMARK_BAR,
+ MENU_ACTION_SHOW_BOOKMARK_MANAGER,
+ MENU_ACTION_IMPORT_SETTINGS,
+ MENU_ACTION_BOOKMARK_PAGE,
+ MENU_ACTION_BOOKMARK_ALL_TABS,
+ MENU_ACTION_PIN_TO_START_SCREEN,
+ MENU_ACTION_RESTORE_TAB,
+ MENU_ACTION_WIN_DESKTOP_RESTART,
+ MENU_ACTION_WIN8_METRO_RESTART,
+ MENU_ACTION_WIN_CHROMEOS_RESTART,
+ MENU_ACTION_DISTILL_PAGE,
+ MENU_ACTION_SAVE_PAGE,
+ MENU_ACTION_FIND,
+ MENU_ACTION_PRINT,
+ MENU_ACTION_CUT,
+ MENU_ACTION_COPY,
+ MENU_ACTION_PASTE,
+ MENU_ACTION_CREATE_HOSTED_APP,
+ MENU_ACTION_CREATE_SHORTCUTS,
+ MENU_ACTION_MANAGE_EXTENSIONS,
+ MENU_ACTION_TASK_MANAGER,
+ MENU_ACTION_CLEAR_BROWSING_DATA,
+ MENU_ACTION_VIEW_SOURCE,
+ MENU_ACTION_DEV_TOOLS,
+ MENU_ACTION_DEV_TOOLS_CONSOLE,
+ MENU_ACTION_DEV_TOOLS_DEVICES,
+ MENU_ACTION_PROFILING_ENABLED,
+ MENU_ACTION_ZOOM_MINUS,
+ MENU_ACTION_ZOOM_PLUS,
+ MENU_ACTION_FULLSCREEN,
+ MENU_ACTION_SHOW_HISTORY,
+ MENU_ACTION_SHOW_DOWNLOADS,
+ MENU_ACTION_SHOW_SYNC_SETUP,
+ MENU_ACTION_OPTIONS,
+ MENU_ACTION_ABOUT,
+ MENU_ACTION_HELP_PAGE_VIA_MENU,
+ MENU_ACTION_FEEDBACK,
+ MENU_ACTION_TOGGLE_REQUEST_TABLET_SITE,
+ MENU_ACTION_EXIT,
+ MENU_ACTION_RECENT_TAB,
+ MENU_ACTION_BOOKMARK_OPEN,
+ LIMIT_MENU_ACTION
+};
+
// A menu model that builds the contents of an encoding menu.
class EncodingMenuModel : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate {
@@ -157,6 +207,23 @@ class WrenchMenuModel : public ui::SimpleMenuModel,
bool ShouldShowNewIncognitoWindowMenuItem();
+ // Called when a command is selected.
+ // Logs UMA metrics about which command was chosen and how long the user
+ // took to select the command.
+ void LogMenuMetrics(int command_id);
+
+ // Helper function to record the menu action in a UMA histogram.
+ void LogMenuAction(int 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_;
+
+ // Whether a UMA menu action has been recorded since the menu is open.
+ // Only the first time to action is recorded since some commands
+ // (zoom controls) don't dimiss the menu.
+ bool uma_action_recorded_;
+
// Models for the special menu items with buttons.
scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_;
scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_;