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

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: 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 #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 // Lazy creation of the DesktopTaskSwitchMetricRecorder because it accesses
609 // Shell::GetInstance() which is not available when |this| is instantiated.
610 if (!desktop_task_switch_metric_recorder_) {
611 desktop_task_switch_metric_recorder_.reset(
612 new DesktopTaskSwitchMetricRecorder());
613 }
614 }
615
616 void UserMetricsRecorder::OnShellShuttingDown() {
617 desktop_task_switch_metric_recorder_.reset();
618 }
619
601 void UserMetricsRecorder::RecordPeriodicMetrics() { 620 void UserMetricsRecorder::RecordPeriodicMetrics() {
602 ShelfLayoutManager* manager = 621 ShelfLayoutManager* manager =
603 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()); 622 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow());
604 // TODO(bruthig): Investigating whether the check for |manager| is necessary 623 // TODO(bruthig): Investigating whether the check for |manager| is necessary
605 // and add tests if it is. 624 // and add tests if it is.
606 if (manager) { 625 if (manager) {
607 // TODO(bruthig): Consider tracking the time spent in each alignment. 626 // TODO(bruthig): Consider tracking the time spent in each alignment.
608 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", 627 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
609 manager->SelectValueForShelfAlignment( 628 manager->SelectValueForShelfAlignment(
610 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, 629 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
(...skipping 22 matching lines...) Expand all
633 return IsUserActive() && !IsKioskModeActive(); 652 return IsUserActive() && !IsKioskModeActive();
634 } 653 }
635 654
636 void UserMetricsRecorder::StartTimer() { 655 void UserMetricsRecorder::StartTimer() {
637 timer_.Start(FROM_HERE, 656 timer_.Start(FROM_HERE,
638 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 657 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
639 this, &UserMetricsRecorder::RecordPeriodicMetrics); 658 this, &UserMetricsRecorder::RecordPeriodicMetrics);
640 } 659 }
641 660
642 } // namespace ash 661 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698