| OLD | NEW |
| 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 | 8 |
| 9 namespace ash { | 9 namespace ash { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 const char kShelfHistogramName[] = | 13 const char kShelfHistogramName[] = |
| 14 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches"; | 14 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches"; |
| 15 | 15 |
| 16 const char kTabStripHistogramName[] = "Tab.TimeBetweenTabSwitchToActions"; |
| 17 |
| 16 const char kAcceleratorWindowCycleHistogramName[] = | 18 const char kAcceleratorWindowCycleHistogramName[] = |
| 17 "Ash.WindowCycleController.TimeBetweenTaskSwitches"; | 19 "Ash.WindowCycleController.TimeBetweenTaskSwitches"; |
| 18 | 20 |
| 19 // Returns the histogram name for the given |task_switch_source|. | 21 // Returns the histogram name for the given |task_switch_source|. |
| 20 const char* GetHistogramName( | 22 const char* GetHistogramName( |
| 21 TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) { | 23 TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) { |
| 22 switch (task_switch_source) { | 24 switch (task_switch_source) { |
| 23 case TaskSwitchMetricsRecorder::kShelf: | 25 case TaskSwitchMetricsRecorder::kShelf: |
| 24 return kShelfHistogramName; | 26 return kShelfHistogramName; |
| 27 case TaskSwitchMetricsRecorder::kTabStrip: |
| 28 return kTabStripHistogramName; |
| 25 case TaskSwitchMetricsRecorder::kWindowCycleController: | 29 case TaskSwitchMetricsRecorder::kWindowCycleController: |
| 26 return kAcceleratorWindowCycleHistogramName; | 30 return kAcceleratorWindowCycleHistogramName; |
| 27 } | 31 } |
| 28 NOTREACHED(); | 32 NOTREACHED(); |
| 29 return nullptr; | 33 return nullptr; |
| 30 } | 34 } |
| 31 | 35 |
| 32 } // namespace | 36 } // namespace |
| 33 | 37 |
| 34 TaskSwitchMetricsRecorder::TaskSwitchMetricsRecorder() { | 38 TaskSwitchMetricsRecorder::TaskSwitchMetricsRecorder() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 | 65 |
| 62 const char* histogram_name = GetHistogramName(task_switch_source); | 66 const char* histogram_name = GetHistogramName(task_switch_source); |
| 63 DCHECK(histogram_name); | 67 DCHECK(histogram_name); |
| 64 | 68 |
| 65 histogram_map_.add( | 69 histogram_map_.add( |
| 66 task_switch_source, | 70 task_switch_source, |
| 67 make_scoped_ptr(new TaskSwitchTimeTracker(histogram_name))); | 71 make_scoped_ptr(new TaskSwitchTimeTracker(histogram_name))); |
| 68 } | 72 } |
| 69 | 73 |
| 70 } // namespace ash | 74 } // namespace ash |
| OLD | NEW |