OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
6 | 6 |
7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/wm/mru_window_tracker.h" | 8 #include "ash/common/wm/mru_window_tracker.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void WindowCycleController::StartCycling() { | 89 void WindowCycleController::StartCycling() { |
90 MruWindowTracker::WindowList window_list = | 90 MruWindowTracker::WindowList window_list = |
91 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); | 91 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
92 | 92 |
93 active_window_before_window_cycle_ = GetActiveWindow(window_list); | 93 active_window_before_window_cycle_ = GetActiveWindow(window_list); |
94 | 94 |
95 window_cycle_list_.reset(new WindowCycleList(window_list)); | 95 window_cycle_list_.reset(new WindowCycleList(window_list)); |
96 event_handler_.reset(new WindowCycleEventFilter()); | 96 event_handler_.reset(new WindowCycleEventFilter()); |
97 cycle_start_time_ = base::Time::Now(); | 97 cycle_start_time_ = base::Time::Now(); |
98 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE); | 98 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE); |
| 99 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.Items", |
| 100 window_list.size()); |
99 } | 101 } |
100 | 102 |
101 ////////////////////////////////////////////////////////////////////////////// | 103 ////////////////////////////////////////////////////////////////////////////// |
102 // WindowCycleController, private: | 104 // WindowCycleController, private: |
103 | 105 |
104 void WindowCycleController::Step(Direction direction) { | 106 void WindowCycleController::Step(Direction direction) { |
105 DCHECK(window_cycle_list_.get()); | 107 DCHECK(window_cycle_list_.get()); |
106 window_cycle_list_->Step(direction); | 108 window_cycle_list_->Step(direction); |
107 } | 109 } |
108 | 110 |
109 void WindowCycleController::StopCycling() { | 111 void WindowCycleController::StopCycling() { |
| 112 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.SelectionDepth", |
| 113 window_cycle_list_->current_index() + 1); |
110 window_cycle_list_.reset(); | 114 window_cycle_list_.reset(); |
111 | 115 |
112 WmWindow* active_window_after_window_cycle = GetActiveWindow( | 116 WmWindow* active_window_after_window_cycle = GetActiveWindow( |
113 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); | 117 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); |
114 | 118 |
115 // Remove our key event filter. | 119 // Remove our key event filter. |
116 event_handler_.reset(); | 120 event_handler_.reset(); |
117 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime", | 121 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime", |
118 base::Time::Now() - cycle_start_time_); | 122 base::Time::Now() - cycle_start_time_); |
119 | 123 |
120 if (active_window_after_window_cycle != nullptr && | 124 if (active_window_after_window_cycle != nullptr && |
121 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 125 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
122 Shell::GetInstance() | 126 Shell::GetInstance() |
123 ->metrics() | 127 ->metrics() |
124 ->task_switch_metrics_recorder() | 128 ->task_switch_metrics_recorder() |
125 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); | 129 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); |
126 } | 130 } |
127 active_window_before_window_cycle_ = nullptr; | 131 active_window_before_window_cycle_ = nullptr; |
128 } | 132 } |
129 | 133 |
130 } // namespace ash | 134 } // namespace ash |
OLD | NEW |