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

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

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: Added the missed desktop_task_switch_metric_recorder files. 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 #include "ash/metrics/user_metrics_recorder.h" 5 #include "ash/metrics/user_metrics_recorder.h"
6 6
7 #include "ash/metrics/desktop_task_switch_metric_recorder.h"
7 #include "ash/session/session_state_delegate.h" 8 #include "ash/session/session_state_delegate.h"
8 #include "ash/shelf/shelf_delegate.h" 9 #include "ash/shelf/shelf_delegate.h"
9 #include "ash/shelf/shelf_item_types.h" 10 #include "ash/shelf/shelf_item_types.h"
10 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_model.h" 12 #include "ash/shelf/shelf_model.h"
12 #include "ash/shelf/shelf_view.h" 13 #include "ash/shelf/shelf_view.h"
13 #include "ash/shelf/shelf_widget.h" 14 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 16 #include "ash/shell_window_ids.h"
16 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 base::RecordAction( 230 base::RecordAction(
230 base::UserMetricsAction("Accel_Restart_PowerButton")); 231 base::UserMetricsAction("Accel_Restart_PowerButton"));
231 break; 232 break;
232 case ash::UMA_ACCEL_SHUT_DOWN_POWER_BUTTON: 233 case ash::UMA_ACCEL_SHUT_DOWN_POWER_BUTTON:
233 base::RecordAction( 234 base::RecordAction(
234 base::UserMetricsAction("Accel_ShutDown_PowerButton")); 235 base::UserMetricsAction("Accel_ShutDown_PowerButton"));
235 break; 236 break;
236 case ash::UMA_CLOSE_THROUGH_CONTEXT_MENU: 237 case ash::UMA_CLOSE_THROUGH_CONTEXT_MENU:
237 base::RecordAction(base::UserMetricsAction("CloseFromContextMenu")); 238 base::RecordAction(base::UserMetricsAction("CloseFromContextMenu"));
238 break; 239 break;
240 case ash::UMA_DESKTOP_SWITCH_TASK:
241 base::RecordAction(base::UserMetricsAction("Desktop_SwitchTask"));
242 task_switch_metrics_recorder_.OnTaskSwitch(
243 TaskSwitchMetricsRecorder::kDesktop);
244 break;
239 case ash::UMA_DRAG_MAXIMIZE_LEFT: 245 case ash::UMA_DRAG_MAXIMIZE_LEFT:
240 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeLeft")); 246 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeLeft"));
241 break; 247 break;
242 case ash::UMA_DRAG_MAXIMIZE_RIGHT: 248 case ash::UMA_DRAG_MAXIMIZE_RIGHT:
243 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeRight")); 249 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeRight"));
244 break; 250 break;
245 case ash::UMA_GESTURE_OVERVIEW: 251 case ash::UMA_GESTURE_OVERVIEW:
246 base::RecordAction(base::UserMetricsAction("Gesture_Overview")); 252 base::RecordAction(base::UserMetricsAction("Gesture_Overview"));
247 break; 253 break;
248 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE: 254 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE:
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 base::RecordAction( 597 base::RecordAction(
592 base::UserMetricsAction("WindowSelector_OverviewEnterKey")); 598 base::UserMetricsAction("WindowSelector_OverviewEnterKey"));
593 break; 599 break;
594 case ash::UMA_WINDOW_CYCLE: 600 case ash::UMA_WINDOW_CYCLE:
595 base::RecordAction( 601 base::RecordAction(
596 base::UserMetricsAction("WindowCycleController_Cycle")); 602 base::UserMetricsAction("WindowCycleController_Cycle"));
597 break; 603 break;
598 } 604 }
599 } 605 }
600 606
607 void UserMetricsRecorder::OnShellInitialized() {
608 if (!desktop_task_switch_metric_recorder_) {
sky 2015/06/04 20:10:52 Please add comment as to why the conditional.
bruthig 2015/06/05 17:28:21 Done.
609 desktop_task_switch_metric_recorder_.reset(
610 new DesktopTaskSwitchMetricRecorder());
611 }
612 }
613
614 void UserMetricsRecorder::OnShellShuttingDown() {
615 if (desktop_task_switch_metric_recorder_)
sky 2015/06/04 20:10:52 Conditional is not needed.
bruthig 2015/06/05 17:28:21 Done.
616 desktop_task_switch_metric_recorder_.reset();
617 }
618
601 void UserMetricsRecorder::RecordPeriodicMetrics() { 619 void UserMetricsRecorder::RecordPeriodicMetrics() {
602 ShelfLayoutManager* manager = 620 ShelfLayoutManager* manager =
603 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()); 621 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow());
604 // TODO(bruthig): Investigating whether the check for |manager| is necessary 622 // TODO(bruthig): Investigating whether the check for |manager| is necessary
605 // and add tests if it is. 623 // and add tests if it is.
606 if (manager) { 624 if (manager) {
607 // TODO(bruthig): Consider tracking the time spent in each alignment. 625 // TODO(bruthig): Consider tracking the time spent in each alignment.
608 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", 626 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
609 manager->SelectValueForShelfAlignment( 627 manager->SelectValueForShelfAlignment(
610 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, 628 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
(...skipping 22 matching lines...) Expand all
633 return IsUserActive() && !IsKioskModeActive(); 651 return IsUserActive() && !IsKioskModeActive();
634 } 652 }
635 653
636 void UserMetricsRecorder::StartTimer() { 654 void UserMetricsRecorder::StartTimer() {
637 timer_.Start(FROM_HERE, 655 timer_.Start(FROM_HERE,
638 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 656 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
639 this, &UserMetricsRecorder::RecordPeriodicMetrics); 657 this, &UserMetricsRecorder::RecordPeriodicMetrics);
640 } 658 }
641 659
642 } // namespace ash 660 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698