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.
5 #include "ash/metrics/user_metrics_recorder.h"
7 #include "ash/session/session_state_delegate.h"
8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shelf/shelf_view.h"
10 #include "ash/shelf/shelf_widget.h"
11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h"
13 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/wm/window_state.h"
15 #include "base/metrics/histogram.h"
16 #include "base/metrics/user_metrics.h"
17 #include "ui/aura/window.h"
23 // Time in seconds between calls to "RecordPeriodicMetrics".
24 const int kAshPeriodicMetricsTimeInSeconds
= 30 * 60;
26 enum ActiveWindowStateType
{
27 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW
,
28 ACTIVE_WINDOW_STATE_TYPE_OTHER
,
29 ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED
,
30 ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN
,
31 ACTIVE_WINDOW_STATE_TYPE_SNAPPED
,
32 ACTIVE_WINDOW_STATE_TYPE_DOCKED
,
33 ACTIVE_WINDOW_STATE_TYPE_COUNT
36 ActiveWindowStateType
GetActiveWindowState() {
37 ActiveWindowStateType active_window_state_type
=
38 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW
;
39 wm::WindowState
* active_window_state
= ash::wm::GetActiveWindowState();
40 if (active_window_state
) {
41 switch (active_window_state
->GetStateType()) {
42 case wm::WINDOW_STATE_TYPE_MAXIMIZED
:
43 active_window_state_type
= ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED
;
45 case wm::WINDOW_STATE_TYPE_FULLSCREEN
:
46 active_window_state_type
= ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN
;
48 case wm::WINDOW_STATE_TYPE_LEFT_SNAPPED
:
49 case wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED
:
50 active_window_state_type
= ACTIVE_WINDOW_STATE_TYPE_SNAPPED
;
52 case wm::WINDOW_STATE_TYPE_DOCKED
:
53 case wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED
:
54 active_window_state_type
= ACTIVE_WINDOW_STATE_TYPE_DOCKED
;
56 case wm::WINDOW_STATE_TYPE_DEFAULT
:
57 case wm::WINDOW_STATE_TYPE_NORMAL
:
58 case wm::WINDOW_STATE_TYPE_MINIMIZED
:
59 case wm::WINDOW_STATE_TYPE_INACTIVE
:
60 case wm::WINDOW_STATE_TYPE_END
:
61 case wm::WINDOW_STATE_TYPE_AUTO_POSITIONED
:
62 active_window_state_type
= ACTIVE_WINDOW_STATE_TYPE_OTHER
;
66 return active_window_state_type
;
69 // Returns true if kiosk mode is active.
70 bool IsKioskModeActive() {
71 return Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() ==
72 user::LOGGED_IN_KIOSK_APP
;
75 // Returns true if there is an active user and their session isn't currently
78 switch (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus()) {
79 case user::LOGGED_IN_NONE
:
80 case user::LOGGED_IN_LOCKED
:
82 case user::LOGGED_IN_USER
:
83 case user::LOGGED_IN_OWNER
:
84 case user::LOGGED_IN_GUEST
:
85 case user::LOGGED_IN_PUBLIC
:
86 case user::LOGGED_IN_SUPERVISED
:
87 case user::LOGGED_IN_KIOSK_APP
:
94 // Array of window container ids that contain visible windows to be counted for
95 // UMA statistics. Note the containers are ordered from top most visible
96 // container to the lowest to allow the |GetNumVisibleWindows| method to short
97 // circuit when processing a maximized or fullscreen window.
98 int kVisibleWindowContainerIds
[] = {kShellWindowId_PanelContainer
,
99 kShellWindowId_DockedContainer
,
100 kShellWindowId_AlwaysOnTopContainer
,
101 kShellWindowId_DefaultContainer
};
103 // Returns an approximate count of how many windows are currently visible in the
104 // primary root window.
105 int GetNumVisibleWindowsInPrimaryDisplay() {
106 int visible_window_count
= 0;
107 bool maximized_or_fullscreen_window_present
= false;
109 for (const int& current_container_id
: kVisibleWindowContainerIds
) {
110 if (maximized_or_fullscreen_window_present
)
113 const aura::Window::Windows
& children
=
114 Shell::GetContainer(Shell::GetInstance()->GetPrimaryRootWindow(),
115 current_container_id
)->children();
116 // Reverse iterate over the child windows so that they are processed in
117 // visible stacking order.
118 for (aura::Window::Windows::const_reverse_iterator it
= children
.rbegin(),
119 rend
= children
.rend();
121 const aura::Window
* child_window
= *it
;
122 const wm::WindowState
* child_window_state
=
123 wm::GetWindowState(child_window
);
125 if (!child_window
->IsVisible() || child_window_state
->IsMinimized())
128 // Only count activatable windows for 2 reasons:
129 // 1. Ensures that a browser window and its transient, modal child will
130 // only count as 1 visible window.
131 // 2. Prevents counting some windows in the
132 // kShellWindowId_DockedContainer that were not opened by the user.
133 if (child_window_state
->CanActivate())
134 ++visible_window_count
;
136 // Stop counting windows that will be hidden by maximized or fullscreen
137 // windows. Only windows in the kShellWindowId_DefaultContainer and
138 // kShellWindowId_AlwaysOnTopContainer can be maximized or fullscreened
139 // and completely obscure windows beneath them.
140 if ((kShellWindowId_DefaultContainer
== current_container_id
||
141 kShellWindowId_AlwaysOnTopContainer
== current_container_id
) &&
142 child_window_state
->IsMaximizedOrFullscreen()) {
143 maximized_or_fullscreen_window_present
= true;
148 return visible_window_count
;
153 UserMetricsRecorder::UserMetricsRecorder() {
157 UserMetricsRecorder::UserMetricsRecorder(bool record_periodic_metrics
) {
158 if (record_periodic_metrics
)
162 UserMetricsRecorder::~UserMetricsRecorder() {
166 void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action
) {
168 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6
:
170 base::UserMetricsAction("Accel_KeyboardBrightnessDown_F6"));
172 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7
:
174 base::UserMetricsAction("Accel_KeyboardBrightnessUp_F7"));
176 case ash::UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON
:
178 base::UserMetricsAction("Accel_LockScreen_LockButton"));
180 case ash::UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON
:
182 base::UserMetricsAction("Accel_LockScreen_PowerButton"));
184 case ash::UMA_ACCEL_MAXIMIZE_RESTORE_F4
:
186 base::UserMetricsAction("Accel_Maximize_Restore_F4"));
188 case ash::UMA_ACCEL_PREVWINDOW_F5
:
189 base::RecordAction(base::UserMetricsAction("Accel_PrevWindow_F5"));
191 case ash::UMA_ACCEL_EXIT_FIRST_Q
:
192 base::RecordAction(base::UserMetricsAction("Accel_Exit_First_Q"));
194 case ash::UMA_ACCEL_EXIT_SECOND_Q
:
195 base::RecordAction(base::UserMetricsAction("Accel_Exit_Second_Q"));
197 case ash::UMA_ACCEL_RESTART_POWER_BUTTON
:
199 base::UserMetricsAction("Accel_Restart_PowerButton"));
201 case ash::UMA_ACCEL_SHUT_DOWN_POWER_BUTTON
:
203 base::UserMetricsAction("Accel_ShutDown_PowerButton"));
205 case ash::UMA_CLOSE_THROUGH_CONTEXT_MENU
:
206 base::RecordAction(base::UserMetricsAction("CloseFromContextMenu"));
208 case ash::UMA_DRAG_MAXIMIZE_LEFT
:
209 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeLeft"));
211 case ash::UMA_DRAG_MAXIMIZE_RIGHT
:
212 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeRight"));
214 case ash::UMA_GESTURE_OVERVIEW
:
215 base::RecordAction(base::UserMetricsAction("Gesture_Overview"));
217 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE
:
219 base::UserMetricsAction("Launcher_ButtonPressed_Mouse"));
221 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH
:
223 base::UserMetricsAction("Launcher_ButtonPressed_Touch"));
225 case ash::UMA_LAUNCHER_CLICK_ON_APP
:
226 base::RecordAction(base::UserMetricsAction("Launcher_ClickOnApp"));
228 case ash::UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON
:
230 base::UserMetricsAction("Launcher_ClickOnApplistButton"));
232 case ash::UMA_LAUNCHER_LAUNCH_TASK
:
233 base::RecordAction(base::UserMetricsAction("Launcher_LaunchTask"));
235 case ash::UMA_LAUNCHER_MINIMIZE_TASK
:
236 base::RecordAction(base::UserMetricsAction("Launcher_MinimizeTask"));
238 case ash::UMA_LAUNCHER_SWITCH_TASK
:
239 base::RecordAction(base::UserMetricsAction("Launcher_SwitchTask"));
241 case UMA_MAXIMIZE_MODE_DISABLED
:
242 base::RecordAction(base::UserMetricsAction("Touchview_Disabled"));
244 case UMA_MAXIMIZE_MODE_ENABLED
:
245 base::RecordAction(base::UserMetricsAction("Touchview_Enabled"));
247 case UMA_MAXIMIZE_MODE_INITIALLY_DISABLED
:
249 base::UserMetricsAction("Touchview_Initially_Disabled"));
251 case ash::UMA_MOUSE_DOWN
:
252 base::RecordAction(base::UserMetricsAction("Mouse_Down"));
254 case ash::UMA_PANEL_MINIMIZE_CAPTION_CLICK
:
256 base::UserMetricsAction("Panel_Minimize_Caption_Click"));
258 case ash::UMA_PANEL_MINIMIZE_CAPTION_GESTURE
:
260 base::UserMetricsAction("Panel_Minimize_Caption_Gesture"));
262 case ash::UMA_SHELF_ALIGNMENT_SET_BOTTOM
:
264 base::UserMetricsAction("Shelf_AlignmentSetBottom"));
266 case ash::UMA_SHELF_ALIGNMENT_SET_LEFT
:
268 base::UserMetricsAction("Shelf_AlignmentSetLeft"));
270 case ash::UMA_SHELF_ALIGNMENT_SET_RIGHT
:
272 base::UserMetricsAction("Shelf_AlignmentSetRight"));
274 case ash::UMA_STATUS_AREA_AUDIO_CURRENT_INPUT_DEVICE
:
276 base::UserMetricsAction("StatusArea_Audio_CurrentInputDevice"));
278 case ash::UMA_STATUS_AREA_AUDIO_CURRENT_OUTPUT_DEVICE
:
280 base::UserMetricsAction("StatusArea_Audio_CurrentOutputDevice"));
282 case ash::UMA_STATUS_AREA_AUDIO_SWITCH_INPUT_DEVICE
:
284 base::UserMetricsAction("StatusArea_Audio_SwitchInputDevice"));
286 case ash::UMA_STATUS_AREA_AUDIO_SWITCH_OUTPUT_DEVICE
:
288 base::UserMetricsAction("StatusArea_Audio_SwitchOutputDevice"));
290 case ash::UMA_STATUS_AREA_BRIGHTNESS_CHANGED
:
292 base::UserMetricsAction("StatusArea_BrightnessChanged"));
294 case ash::UMA_STATUS_AREA_BLUETOOTH_CONNECT_KNOWN_DEVICE
:
296 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Known"));
298 case ash::UMA_STATUS_AREA_BLUETOOTH_CONNECT_UNKNOWN_DEVICE
:
300 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Unknown"));
302 case ash::UMA_STATUS_AREA_BLUETOOTH_DISABLED
:
304 base::UserMetricsAction("StatusArea_Bluetooth_Disabled"));
306 case ash::UMA_STATUS_AREA_BLUETOOTH_ENABLED
:
308 base::UserMetricsAction("StatusArea_Bluetooth_Enabled"));
310 case ash::UMA_STATUS_AREA_CAPS_LOCK_DETAILED
:
312 base::UserMetricsAction("StatusArea_CapsLock_Detailed"));
314 case ash::UMA_STATUS_AREA_CAPS_LOCK_DISABLED_BY_CLICK
:
316 base::UserMetricsAction("StatusArea_CapsLock_DisabledByClick"));
318 case ash::UMA_STATUS_AREA_CAPS_LOCK_ENABLED_BY_CLICK
:
320 base::UserMetricsAction("StatusArea_CapsLock_EnabledByClick"));
322 case ash::UMA_STATUS_AREA_CAPS_LOCK_POPUP
:
324 base::UserMetricsAction("StatusArea_CapsLock_Popup"));
326 case ash::UMA_STATUS_AREA_CONNECT_TO_CONFIGURED_NETWORK
:
328 base::UserMetricsAction("StatusArea_Network_ConnectConfigured"));
330 case ash::UMA_STATUS_AREA_CONNECT_TO_UNCONFIGURED_NETWORK
:
332 base::UserMetricsAction("StatusArea_Network_ConnectUnconfigured"));
334 case ash::UMA_STATUS_AREA_CONNECT_TO_VPN
:
336 base::UserMetricsAction("StatusArea_VPN_ConnectToNetwork"));
338 case ash::UMA_STATUS_AREA_CHANGED_VOLUME_MENU
:
340 base::UserMetricsAction("StatusArea_Volume_ChangedMenu"));
342 case ash::UMA_STATUS_AREA_CHANGED_VOLUME_POPUP
:
344 base::UserMetricsAction("StatusArea_Volume_ChangedPopup"));
346 case ash::UMA_STATUS_AREA_DETAILED_ACCESSABILITY
:
348 base::UserMetricsAction("StatusArea_Accessability_DetailedView"));
350 case ash::UMA_STATUS_AREA_DETAILED_AUDIO_VIEW
:
352 base::UserMetricsAction("StatusArea_Audio_Detailed"));
354 case ash::UMA_STATUS_AREA_DETAILED_BLUETOOTH_VIEW
:
356 base::UserMetricsAction("StatusArea_Bluetooth_Detailed"));
358 case ash::UMA_STATUS_AREA_DETAILED_BRIGHTNESS_VIEW
:
360 base::UserMetricsAction("StatusArea_Brightness_Detailed"));
362 case ash::UMA_STATUS_AREA_DETAILED_DRIVE_VIEW
:
364 base::UserMetricsAction("StatusArea_Drive_Detailed"));
366 case ash::UMA_STATUS_AREA_DETAILED_NETWORK_VIEW
:
368 base::UserMetricsAction("StatusArea_Network_Detailed"));
370 case ash::UMA_STATUS_AREA_DETAILED_VPN_VIEW
:
372 base::UserMetricsAction("StatusArea_VPN_Detailed"));
374 case ash::UMA_STATUS_AREA_DISABLE_AUTO_CLICK
:
376 base::UserMetricsAction("StatusArea_AutoClickDisabled"));
378 case ash::UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST
:
380 base::UserMetricsAction("StatusArea_HighContrastDisabled"));
382 case ash::UMA_STATUS_AREA_DISABLE_LARGE_CURSOR
:
384 base::UserMetricsAction("StatusArea_LargeCursorDisabled"));
386 case ash::UMA_STATUS_AREA_DISABLE_MAGNIFIER
:
388 base::UserMetricsAction("StatusArea_MagnifierDisabled"));
390 case ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK
:
392 base::UserMetricsAction("StatusArea_SpokenFeedbackDisabled"));
394 case ash::UMA_STATUS_AREA_DISABLE_VIRTUAL_KEYBOARD
:
396 base::UserMetricsAction("StatusArea_VirtualKeyboardDisabled"));
398 case ash::UMA_STATUS_AREA_DISABLE_WIFI
:
400 base::UserMetricsAction("StatusArea_Network_WifiDisabled"));
402 case ash::UMA_STATUS_AREA_DRIVE_CANCEL_OPERATION
:
404 base::UserMetricsAction("StatusArea_Drive_CancelOperation"));
406 case ash::UMA_STATUS_AREA_DRIVE_SETTINGS
:
408 base::UserMetricsAction("StatusArea_Drive_Settings"));
410 case ash::UMA_STATUS_AREA_ENABLE_AUTO_CLICK
:
412 base::UserMetricsAction("StatusArea_AutoClickEnabled"));
414 case ash::UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST
:
416 base::UserMetricsAction("StatusArea_HighContrastEnabled"));
418 case ash::UMA_STATUS_AREA_ENABLE_LARGE_CURSOR
:
420 base::UserMetricsAction("StatusArea_LargeCursorEnabled"));
422 case ash::UMA_STATUS_AREA_ENABLE_MAGNIFIER
:
424 base::UserMetricsAction("StatusArea_MagnifierEnabled"));
426 case ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK
:
428 base::UserMetricsAction("StatusArea_SpokenFeedbackEnabled"));
430 case ash::UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD
:
432 base::UserMetricsAction("StatusArea_VirtualKeyboardEnabled"));
434 case ash::UMA_STATUS_AREA_ENABLE_WIFI
:
436 base::UserMetricsAction("StatusArea_Network_WifiEnabled"));
438 case ash::UMA_STATUS_AREA_IME_SHOW_DETAILED
:
440 base::UserMetricsAction("StatusArea_IME_Detailed"));
442 case ash::UMA_STATUS_AREA_IME_SWITCH_MODE
:
444 base::UserMetricsAction("StatusArea_IME_SwitchMode"));
446 case ash::UMA_STATUS_AREA_MENU_OPENED
:
448 base::UserMetricsAction("StatusArea_MenuOpened"));
450 case ash::UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED
:
452 base::UserMetricsAction("StatusArea_Network_JoinOther"));
454 case ash::UMA_STATUS_AREA_NETWORK_SETTINGS_CLICKED
:
456 base::UserMetricsAction("StatusArea_Network_Settings"));
458 case ash::UMA_STATUS_AREA_SHOW_NETWORK_CONNECTION_DETAILS
:
460 base::UserMetricsAction("StatusArea_Network_ConnectionDetails"));
462 case ash::UMA_STATUS_AREA_SHOW_VPN_CONNECTION_DETAILS
:
464 base::UserMetricsAction("StatusArea_VPN_ConnectionDetails"));
466 case ash::UMA_STATUS_AREA_SIGN_OUT
:
468 base::UserMetricsAction("StatusArea_SignOut"));
470 case ash::UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED
:
471 base::RecordAction(base::UserMetricsAction("StatusArea_VPN_AddBuiltIn"));
473 case ash::UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED
:
475 base::UserMetricsAction("StatusArea_VPN_AddThirdParty"));
477 case ash::UMA_STATUS_AREA_VPN_DISCONNECT_CLICKED
:
478 base::RecordAction(base::UserMetricsAction("StatusArea_VPN_Disconnect"));
480 case ash::UMA_STATUS_AREA_VPN_SETTINGS_CLICKED
:
482 base::UserMetricsAction("StatusArea_VPN_Settings"));
484 case ash::UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK
:
486 base::UserMetricsAction("Caption_ClickTogglesMaximize"));
488 case ash::UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE
:
490 base::UserMetricsAction("Caption_GestureTogglesMaximize"));
492 case ash::UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK
:
494 base::UserMetricsAction(
495 "WindowBorder_ClickTogglesSingleAxisMaximize"));
497 case ash::UMA_TOUCHPAD_GESTURE_OVERVIEW
:
499 base::UserMetricsAction("Touchpad_Gesture_Overview"));
501 case ash::UMA_TOUCHSCREEN_TAP_DOWN
:
502 base::RecordAction(base::UserMetricsAction("Touchscreen_Down"));
504 case ash::UMA_TRAY_HELP
:
505 base::RecordAction(base::UserMetricsAction("Tray_Help"));
507 case ash::UMA_TRAY_LOCK_SCREEN
:
508 base::RecordAction(base::UserMetricsAction("Tray_LockScreen"));
510 case ash::UMA_TRAY_SHUT_DOWN
:
511 base::RecordAction(base::UserMetricsAction("Tray_ShutDown"));
513 case ash::UMA_WINDOW_APP_CLOSE_BUTTON_CLICK
:
514 base::RecordAction(base::UserMetricsAction("AppCloseButton_Clk"));
516 case ash::UMA_WINDOW_CLOSE_BUTTON_CLICK
:
517 base::RecordAction(base::UserMetricsAction("CloseButton_Clk"));
519 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN
:
520 base::RecordAction(base::UserMetricsAction("MaxButton_Clk_ExitFS"));
522 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE
:
524 base::UserMetricsAction("MaxButton_Clk_Restore"));
526 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE
:
528 base::UserMetricsAction("MaxButton_Clk_Maximize"));
530 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE
:
531 base::RecordAction(base::UserMetricsAction("MinButton_Clk"));
533 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT
:
534 base::RecordAction(base::UserMetricsAction("MaxButton_MaxLeft"));
536 case ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT
:
537 base::RecordAction(base::UserMetricsAction("MaxButton_MaxRight"));
539 case ash::UMA_WINDOW_OVERVIEW
:
541 base::UserMetricsAction("WindowSelector_Overview"));
543 case ash::UMA_WINDOW_OVERVIEW_ENTER_KEY
:
545 base::UserMetricsAction("WindowSelector_OverviewEnterKey"));
547 case ash::UMA_WINDOW_CYCLE
:
549 base::UserMetricsAction("WindowCycleController_Cycle"));
554 void UserMetricsRecorder::RecordPeriodicMetrics() {
555 ShelfLayoutManager
* manager
=
556 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow());
557 // TODO(bruthig): Investigating whether the check for |manager| is necessary
558 // and add tests if it is.
560 // TODO(bruthig): Consider tracking the time spent in each alignment.
561 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
562 manager
->SelectValueForShelfAlignment(
563 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM
,
564 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT
,
565 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT
,
567 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT
);
570 if (IsUserInActiveDesktopEnvironment()) {
571 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay",
572 GetNumVisibleWindowsInPrimaryDisplay());
575 // TODO(bruthig): Find out if this should only be logged when the user is
577 // TODO(bruthig): Consider tracking how long a particular type of window is
579 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime",
580 GetActiveWindowState(),
581 ACTIVE_WINDOW_STATE_TYPE_COUNT
);
584 bool UserMetricsRecorder::IsUserInActiveDesktopEnvironment() const {
585 return IsUserActive() && !IsKioskModeActive();
588 void UserMetricsRecorder::StartTimer() {
589 timer_
.Start(FROM_HERE
,
590 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds
),
591 this, &UserMetricsRecorder::RecordPeriodicMetrics
);