OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/wm/window_cycle_list.h" | 9 #include "ash/wm/window_cycle_list.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 void WindowCycleController::AltKeyReleased() { | 121 void WindowCycleController::AltKeyReleased() { |
122 StopCycling(); | 122 StopCycling(); |
123 } | 123 } |
124 | 124 |
125 ////////////////////////////////////////////////////////////////////////////// | 125 ////////////////////////////////////////////////////////////////////////////// |
126 // WindowCycleController, private: | 126 // WindowCycleController, private: |
127 | 127 |
128 void WindowCycleController::StartCycling() { | 128 void WindowCycleController::StartCycling() { |
129 // Most-recently-used cycling is confusing in compact window mode because | |
130 // you can't see all the windows. | |
131 windows_.reset(new WindowCycleList( | 129 windows_.reset(new WindowCycleList( |
132 ash::Shell::GetInstance()->delegate()->GetCycleWindowList( | 130 ash::Shell::GetInstance()->delegate()->GetCycleWindowList( |
133 ShellDelegate::SOURCE_KEYBOARD, | 131 ShellDelegate::SOURCE_KEYBOARD))); |
134 Shell::GetInstance()->IsWindowModeCompact() ? | |
135 ShellDelegate::ORDER_LINEAR : ShellDelegate::ORDER_MRU))); | |
136 } | 132 } |
137 | 133 |
138 void WindowCycleController::Step(Direction direction) { | 134 void WindowCycleController::Step(Direction direction) { |
139 DCHECK(windows_.get()); | 135 DCHECK(windows_.get()); |
140 windows_->Step(direction == FORWARD ? WindowCycleList::FORWARD : | 136 windows_->Step(direction == FORWARD ? WindowCycleList::FORWARD : |
141 WindowCycleList::BACKWARD); | 137 WindowCycleList::BACKWARD); |
142 } | 138 } |
143 | 139 |
144 void WindowCycleController::StopCycling() { | 140 void WindowCycleController::StopCycling() { |
145 windows_.reset(); | 141 windows_.reset(); |
146 // Remove our key event filter. | 142 // Remove our key event filter. |
147 if (event_filter_.get()) { | 143 if (event_filter_.get()) { |
148 Shell::GetInstance()->RemoveRootWindowEventFilter(event_filter_.get()); | 144 Shell::GetInstance()->RemoveRootWindowEventFilter(event_filter_.get()); |
149 event_filter_.reset(); | 145 event_filter_.reset(); |
150 } | 146 } |
151 } | 147 } |
152 | 148 |
153 void WindowCycleController::InstallEventFilter() { | 149 void WindowCycleController::InstallEventFilter() { |
154 event_filter_.reset(new WindowCycleEventFilter()); | 150 event_filter_.reset(new WindowCycleEventFilter()); |
155 Shell::GetInstance()->AddRootWindowEventFilter(event_filter_.get()); | 151 Shell::GetInstance()->AddRootWindowEventFilter(event_filter_.get()); |
156 } | 152 } |
157 | 153 |
158 } // namespace ash | 154 } // namespace ash |
OLD | NEW |