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

Side by Side Diff: ash/metrics/user_metrics_recorder.h

Issue 1153633006: Added UMA statistics for changing the active window via click or touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the branch that the CL was based on. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_METRICS_USER_METRICS_RECORDER_H_ 5 #ifndef ASH_METRICS_USER_METRICS_RECORDER_H_
6 #define ASH_METRICS_USER_METRICS_RECORDER_H_ 6 #define ASH_METRICS_USER_METRICS_RECORDER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/metrics/task_switch_metrics_recorder.h" 9 #include "ash/metrics/task_switch_metrics_recorder.h"
10 #include "base/memory/scoped_ptr.h"
10 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
11 12
12 namespace ash { 13 namespace ash {
13 14
15 class DesktopTaskSwitchMetricRecorder;
16
14 namespace test { 17 namespace test {
15 class UserMetricsRecorderTestAPI; 18 class UserMetricsRecorderTestAPI;
16 } 19 }
17 20
18 enum UserMetricsAction { 21 enum UserMetricsAction {
19 UMA_ACCEL_EXIT_FIRST_Q, 22 UMA_ACCEL_EXIT_FIRST_Q,
20 UMA_ACCEL_EXIT_SECOND_Q, 23 UMA_ACCEL_EXIT_SECOND_Q,
21 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6, 24 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6,
22 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7, 25 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7,
23 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON, 26 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON,
24 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON, 27 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON,
25 UMA_ACCEL_MAXIMIZE_RESTORE_F4, 28 UMA_ACCEL_MAXIMIZE_RESTORE_F4,
26 UMA_ACCEL_PREVWINDOW_F5, 29 UMA_ACCEL_PREVWINDOW_F5,
27 UMA_ACCEL_RESTART_POWER_BUTTON, 30 UMA_ACCEL_RESTART_POWER_BUTTON,
28 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON, 31 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON,
29 UMA_CLOSE_THROUGH_CONTEXT_MENU, 32 UMA_CLOSE_THROUGH_CONTEXT_MENU,
33 UMA_DESKTOP_SWITCH_TASK,
30 UMA_DRAG_MAXIMIZE_LEFT, 34 UMA_DRAG_MAXIMIZE_LEFT,
31 UMA_DRAG_MAXIMIZE_RIGHT, 35 UMA_DRAG_MAXIMIZE_RIGHT,
32 UMA_GESTURE_OVERVIEW, 36 UMA_GESTURE_OVERVIEW,
33 UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE, 37 UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE,
34 UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH, 38 UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH,
35 UMA_LAUNCHER_CLICK_ON_APP, 39 UMA_LAUNCHER_CLICK_ON_APP,
36 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON, 40 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON,
37 UMA_LAUNCHER_LAUNCH_TASK, 41 UMA_LAUNCHER_LAUNCH_TASK,
38 UMA_LAUNCHER_MINIMIZE_TASK, 42 UMA_LAUNCHER_MINIMIZE_TASK,
39 UMA_LAUNCHER_SWITCH_TASK, 43 UMA_LAUNCHER_SWITCH_TASK,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 150
147 virtual ~UserMetricsRecorder(); 151 virtual ~UserMetricsRecorder();
148 152
149 // Records an Ash owned user action. 153 // Records an Ash owned user action.
150 void RecordUserMetricsAction(ash::UserMetricsAction action); 154 void RecordUserMetricsAction(ash::UserMetricsAction action);
151 155
152 TaskSwitchMetricsRecorder& task_switch_metrics_recorder() { 156 TaskSwitchMetricsRecorder& task_switch_metrics_recorder() {
153 return task_switch_metrics_recorder_; 157 return task_switch_metrics_recorder_;
154 } 158 }
155 159
160 // Informs |this| that the Shell has been initialized.
161 void OnShellInitialized();
162
163 // Informs |this| that the Shell is going to be shut down.
164 void OnShellShuttingDown();
165
156 private: 166 private:
157 friend class test::UserMetricsRecorderTestAPI; 167 friend class test::UserMetricsRecorderTestAPI;
158 168
159 // Creates a UserMetricsRecorder and will only record periodic metrics if 169 // Creates a UserMetricsRecorder and will only record periodic metrics if
160 // |record_periodic_metrics| is true. This is used by tests that do not want 170 // |record_periodic_metrics| is true. This is used by tests that do not want
161 // the timer to be started. 171 // the timer to be started.
162 // TODO(bruthig): Add a constructor that accepts a base::RepeatingTimer so 172 // TODO(bruthig): Add a constructor that accepts a base::RepeatingTimer so
163 // that tests can inject a test double that can be controlled by the test. The 173 // that tests can inject a test double that can be controlled by the test. The
164 // missing piece is a suitable base::RepeatingTimer test double. 174 // missing piece is a suitable base::RepeatingTimer test double.
165 explicit UserMetricsRecorder(bool record_periodic_metrics); 175 explicit UserMetricsRecorder(bool record_periodic_metrics);
166 176
167 // Records UMA metrics. Invoked periodically by the |timer_|. 177 // Records UMA metrics. Invoked periodically by the |timer_|.
168 void RecordPeriodicMetrics(); 178 void RecordPeriodicMetrics();
169 179
170 // Returns true if the user's session is active and they are in a desktop 180 // Returns true if the user's session is active and they are in a desktop
171 // environment. 181 // environment.
172 bool IsUserInActiveDesktopEnvironment() const; 182 bool IsUserInActiveDesktopEnvironment() const;
173 183
174 // Starts the |timer_| and binds it to |RecordPeriodicMetrics|. 184 // Starts the |timer_| and binds it to |RecordPeriodicMetrics|.
175 void StartTimer(); 185 void StartTimer();
176 186
177 // The periodic timer that triggers metrics to be recorded. 187 // The periodic timer that triggers metrics to be recorded.
178 base::RepeatingTimer<UserMetricsRecorder> timer_; 188 base::RepeatingTimer<UserMetricsRecorder> timer_;
179 189
180 TaskSwitchMetricsRecorder task_switch_metrics_recorder_; 190 TaskSwitchMetricsRecorder task_switch_metrics_recorder_;
181 191
192 // Metric recorder to track how often task windows are activated by mouse
193 // clicks or touchscreen taps.
194 scoped_ptr<DesktopTaskSwitchMetricRecorder>
195 desktop_task_switch_metric_recorder_;
196
182 DISALLOW_COPY_AND_ASSIGN(UserMetricsRecorder); 197 DISALLOW_COPY_AND_ASSIGN(UserMetricsRecorder);
183 }; 198 };
184 199
185 } // namespace ash 200 } // namespace ash
186 201
187 #endif // ASH_METRICS_USER_METRICS_RECORDER_H_ 202 #endif // ASH_METRICS_USER_METRICS_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698