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

Side by Side Diff: ash/metrics/task_switch_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: Polish and added unit tests. 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_switch_metrics_recorder.h" 5 #include "ash/metrics/task_switch_metrics_recorder.h"
6 6
7 #include "ash/metrics/task_switch_time_tracker.h" 7 #include "ash/metrics/task_switch_time_tracker.h"
8 #include "ui/aura/window.h"
9 #include "ui/wm/public/window_types.h"
8 10
9 namespace ash { 11 namespace ash {
10 12
11 namespace { 13 namespace {
12 14
15 const char kDesktopHistogramName[] =
16 "Ash.Desktop.TimeBetweenNavigateToTaskSwitches";
17
13 const char kShelfHistogramName[] = 18 const char kShelfHistogramName[] =
14 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches"; 19 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches";
15 20
16 const char kTabStripHistogramName[] = 21 const char kTabStripHistogramName[] =
17 "Ash.Tab.TimeBetweenSwitchToExistingTabUserActions"; 22 "Ash.Tab.TimeBetweenSwitchToExistingTabUserActions";
18 23
19 const char kAcceleratorWindowCycleHistogramName[] = 24 const char kAcceleratorWindowCycleHistogramName[] =
20 "Ash.WindowCycleController.TimeBetweenTaskSwitches"; 25 "Ash.WindowCycleController.TimeBetweenTaskSwitches";
21 26
22 const char kAppListHistogramName[] = "Ash.AppList.TimeBetweenTaskSwitches"; 27 const char kAppListHistogramName[] = "Ash.AppList.TimeBetweenTaskSwitches";
23 28
24 const char kOverviewModeHistogramName[] = 29 const char kOverviewModeHistogramName[] =
25 "Ash.WindowSelector.TimeBetweenActiveWindowChanges"; 30 "Ash.WindowSelector.TimeBetweenActiveWindowChanges";
26 31
27 // Returns the histogram name for the given |task_switch_source|. 32 // Returns the histogram name for the given |task_switch_source|.
28 const char* GetHistogramName( 33 const char* GetHistogramName(
29 TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) { 34 TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) {
30 switch (task_switch_source) { 35 switch (task_switch_source) {
31 case TaskSwitchMetricsRecorder::kAppList: 36 case TaskSwitchMetricsRecorder::kAppList:
32 return kAppListHistogramName; 37 return kAppListHistogramName;
38 case TaskSwitchMetricsRecorder::kDesktop:
39 return kDesktopHistogramName;
33 case TaskSwitchMetricsRecorder::kOverviewMode: 40 case TaskSwitchMetricsRecorder::kOverviewMode:
34 return kOverviewModeHistogramName; 41 return kOverviewModeHistogramName;
35 case TaskSwitchMetricsRecorder::kShelf: 42 case TaskSwitchMetricsRecorder::kShelf:
36 return kShelfHistogramName; 43 return kShelfHistogramName;
37 case TaskSwitchMetricsRecorder::kTabStrip: 44 case TaskSwitchMetricsRecorder::kTabStrip:
38 return kTabStripHistogramName; 45 return kTabStripHistogramName;
39 case TaskSwitchMetricsRecorder::kWindowCycleController: 46 case TaskSwitchMetricsRecorder::kWindowCycleController:
40 return kAcceleratorWindowCycleHistogramName; 47 return kAcceleratorWindowCycleHistogramName;
41 } 48 }
42 NOTREACHED(); 49 NOTREACHED();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 82
76 const char* histogram_name = GetHistogramName(task_switch_source); 83 const char* histogram_name = GetHistogramName(task_switch_source);
77 DCHECK(histogram_name); 84 DCHECK(histogram_name);
78 85
79 histogram_map_.add( 86 histogram_map_.add(
80 task_switch_source, 87 task_switch_source,
81 make_scoped_ptr(new TaskSwitchTimeTracker(histogram_name))); 88 make_scoped_ptr(new TaskSwitchTimeTracker(histogram_name)));
82 } 89 }
83 90
84 } // namespace ash 91 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698