1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_USER_METRICS_RECORDER_H_ 6 #define ASH_USER_METRICS_RECORDER_H_ 7 8 #include "ash/ash_export.h" 9 #include "base/timer/timer.h" 10 11 namespace ash { 12 13 enum UserMetricsAction { 14 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6, 15 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7, 16 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON, 17 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON, 18 UMA_ACCEL_MAXIMIZE_RESTORE_F4, 19 UMA_ACCEL_PREVWINDOW_F5, 20 UMA_ACCEL_EXIT_FIRST_Q, 21 UMA_ACCEL_EXIT_SECOND_Q, 22 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON, 23 UMA_CLOSE_THROUGH_CONTEXT_MENU, 24 UMA_DRAG_MAXIMIZE_LEFT, 25 UMA_DRAG_MAXIMIZE_RIGHT, 26 UMA_GESTURE_OVERVIEW, 27 UMA_LAUNCHER_CLICK_ON_APP, 28 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON, 29 UMA_MOUSE_DOWN, 30 UMA_PANEL_MINIMIZE_CAPTION_CLICK, 31 UMA_PANEL_MINIMIZE_CAPTION_GESTURE, 32 UMA_SHELF_ALIGNMENT_SET_BOTTOM, 33 UMA_SHELF_ALIGNMENT_SET_LEFT, 34 UMA_SHELF_ALIGNMENT_SET_RIGHT, 35 UMA_STATUS_AREA_AUDIO_CURRENT_INPUT_DEVICE, 36 UMA_STATUS_AREA_AUDIO_CURRENT_OUTPUT_DEVICE, 37 UMA_STATUS_AREA_AUDIO_SWITCH_INPUT_DEVICE, 38 UMA_STATUS_AREA_AUDIO_SWITCH_OUTPUT_DEVICE, 39 UMA_STATUS_AREA_BRIGHTNESS_CHANGED, 40 UMA_STATUS_AREA_BLUETOOTH_CONNECT_KNOWN_DEVICE, 41 UMA_STATUS_AREA_BLUETOOTH_CONNECT_UNKNOWN_DEVICE, 42 UMA_STATUS_AREA_BLUETOOTH_DISABLED, 43 UMA_STATUS_AREA_BLUETOOTH_ENABLED, 44 UMA_STATUS_AREA_CAPS_LOCK_DETAILED, 45 UMA_STATUS_AREA_CAPS_LOCK_DISABLED_BY_CLICK, 46 UMA_STATUS_AREA_CAPS_LOCK_ENABLED_BY_CLICK, 47 UMA_STATUS_AREA_CAPS_LOCK_POPUP, 48 UMA_STATUS_AREA_CONNECT_TO_CONFIGURED_NETWORK, 49 UMA_STATUS_AREA_CONNECT_TO_UNCONFIGURED_NETWORK, 50 UMA_STATUS_AREA_CONNECT_TO_VPN, 51 UMA_STATUS_AREA_CHANGED_VOLUME_MENU, 52 UMA_STATUS_AREA_CHANGED_VOLUME_POPUP, 53 UMA_STATUS_AREA_DETAILED_ACCESSABILITY, 54 UMA_STATUS_AREA_DETAILED_AUDIO_VIEW, 55 UMA_STATUS_AREA_DETAILED_BLUETOOTH_VIEW, 56 UMA_STATUS_AREA_DETAILED_BRIGHTNESS_VIEW, 57 UMA_STATUS_AREA_DETAILED_DRIVE_VIEW, 58 UMA_STATUS_AREA_DETAILED_NETWORK_VIEW, 59 UMA_STATUS_AREA_DETAILED_VPN_VIEW, 60 UMA_STATUS_AREA_DISABLE_AUTO_CLICK, 61 UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST, 62 UMA_STATUS_AREA_DISABLE_LARGE_CURSOR, 63 UMA_STATUS_AREA_DISABLE_MAGNIFIER, 64 UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK, 65 UMA_STATUS_AREA_DISABLE_WIFI, 66 UMA_STATUS_AREA_DISABLE_VIRTUAL_KEYBOARD, 67 UMA_STATUS_AREA_DRIVE_CANCEL_OPERATION, 68 UMA_STATUS_AREA_DRIVE_SETTINGS, 69 UMA_STATUS_AREA_ENABLE_AUTO_CLICK, 70 UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST, 71 UMA_STATUS_AREA_ENABLE_LARGE_CURSOR, 72 UMA_STATUS_AREA_ENABLE_MAGNIFIER, 73 UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK, 74 UMA_STATUS_AREA_ENABLE_WIFI, 75 UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD, 76 UMA_STATUS_AREA_IME_SHOW_DETAILED, 77 UMA_STATUS_AREA_IME_SWITCH_MODE, 78 UMA_STATUS_AREA_MENU_OPENED, 79 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED, 80 UMA_STATUS_AREA_NETWORK_SETTINGS_CLICKED, 81 UMA_STATUS_AREA_SHOW_NETWORK_CONNECTION_DETAILS, 82 UMA_STATUS_AREA_SHOW_VPN_CONNECTION_DETAILS, 83 UMA_STATUS_AREA_SIGN_OUT, 84 UMA_STATUS_AREA_VPN_JOIN_OTHER_CLICKED, 85 UMA_STATUS_AREA_VPN_SETTINGS_CLICKED, 86 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK, 87 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE, 88 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK, 89 UMA_TOUCHPAD_GESTURE_OVERVIEW, 90 UMA_TOUCHSCREEN_TAP_DOWN, 91 UMA_TRAY_HELP, 92 UMA_TRAY_LOCK_SCREEN, 93 UMA_TRAY_SHUT_DOWN, 94 UMA_WINDOW_APP_CLOSE_BUTTON_CLICK, 95 UMA_WINDOW_CLOSE_BUTTON_CLICK, 96 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN, 97 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE, 98 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE, 99 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE, 100 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT, 101 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT, 102 103 // Thumbnail sized overview of windows triggered by pressing the overview key. 104 UMA_WINDOW_OVERVIEW, 105 106 // Selecting a window in overview mode by pressing the enter key. 107 UMA_WINDOW_OVERVIEW_ENTER_KEY, 108 109 // Window selection started by beginning an alt+tab cycle. This does not count 110 // each step through an alt+tab cycle. 111 UMA_WINDOW_CYCLE, 112 }; 113 114 // User Metrics Recorder provides a repeating callback (RecordPeriodicMetrics) 115 // on a timer to allow recording of state data over time to the UMA records. 116 // Any additional states (in ash) that require monitoring can be added to 117 // this class. As well calls to record on action metrics 118 // (RecordUserMetricsAction) are passed through the UserMetricsRecorder. 119 class ASH_EXPORT UserMetricsRecorder { 120 public: 121 UserMetricsRecorder(); 122 ~UserMetricsRecorder(); 123 124 void RecordUserMetricsAction(ash::UserMetricsAction action); 125 private: 126 void RecordPeriodicMetrics(); 127 128 base::RepeatingTimer<UserMetricsRecorder> timer_; 129 }; 130 131 } // namespace ash 132 133 #endif // ASH_USER_METRICS_RECORDER_H_ 134