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

Side by Side Diff: ash/wm/window_cycle_controller.cc

Issue 20415002: Add window overview mode behind --ash-enable-overview-mode flag to F5 key. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 5 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 (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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/session_state_delegate.h" 9 #include "ash/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/wm/activation_controller.h" 12 #include "ash/wm/activation_controller.h"
13 #include "ash/wm/window_cycle_list.h" 13 #include "ash/wm/window_cycle_list.h"
14 #include "ash/wm/window_selector.h"
14 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
15 #include "ash/wm/workspace_controller.h" 16 #include "ash/wm/workspace_controller.h"
16 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
17 #include "ui/base/events/event.h" 18 #include "ui/base/events/event.h"
18 #include "ui/base/events/event_handler.h" 19 #include "ui/base/events/event_handler.h"
19 20
20 namespace ash { 21 namespace ash {
21 22
22 namespace { 23 namespace {
23 24
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Use the reversed list of windows to prevent a 2-cycle of the most recent 158 // Use the reversed list of windows to prevent a 2-cycle of the most recent
158 // windows occurring. 159 // windows occurring.
159 WindowCycleList cycle_list(BuildWindowList(NULL,true)); 160 WindowCycleList cycle_list(BuildWindowList(NULL,true));
160 cycle_list.Step(WindowCycleList::FORWARD); 161 cycle_list.Step(WindowCycleList::FORWARD);
161 } 162 }
162 163
163 void WindowCycleController::AltKeyReleased() { 164 void WindowCycleController::AltKeyReleased() {
164 StopCycling(); 165 StopCycling();
165 } 166 }
166 167
168 void WindowCycleController::ToggleOverview() {
169 if (window_selector_.get()) {
170 window_selector_.reset();
171 } else {
172 std::vector<aura::Window*> windows = BuildWindowList(NULL, false);
173 // Don't enter overview mode with no windows.
174 if (windows.empty())
175 return;
176
177 // Deactivating the window will hide popup windows like the omnibar or
178 // open menus.
179 aura::Window* active_window = wm::GetActiveWindow();
180 if (active_window)
181 wm::DeactivateWindow(active_window);
182 window_selector_.reset(new WindowSelector(windows, this));
183 }
184 }
185
186 void WindowCycleController::SelectWindow(aura::Window* window) {
187 window_selector_.reset();
188 wm::ActivateWindow(window);
189 mru_windows_.remove(window);
190 mru_windows_.push_front(window);
191 }
192
167 // static 193 // static
168 std::vector<aura::Window*> WindowCycleController::BuildWindowList( 194 std::vector<aura::Window*> WindowCycleController::BuildWindowList(
169 const std::list<aura::Window*>* mru_windows, 195 const std::list<aura::Window*>* mru_windows,
170 bool top_most_at_end) { 196 bool top_most_at_end) {
171 WindowCycleList::WindowList windows; 197 WindowCycleList::WindowList windows;
172 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 198 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
173 199
174 aura::RootWindow* active_root = Shell::GetActiveRootWindow(); 200 aura::RootWindow* active_root = Shell::GetActiveRootWindow();
175 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); 201 for (Shell::RootWindowList::const_iterator iter = root_windows.begin();
176 iter != root_windows.end(); ++iter) { 202 iter != root_windows.end(); ++iter) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 mru_windows_.remove(window); 322 mru_windows_.remove(window);
297 if (window->id() == internal::kShellWindowId_WorkspaceContainer) 323 if (window->id() == internal::kShellWindowId_WorkspaceContainer)
298 window->RemoveObserver(this); 324 window->RemoveObserver(this);
299 } 325 }
300 326
301 void WindowCycleController::OnWindowDestroying(aura::Window* window) { 327 void WindowCycleController::OnWindowDestroying(aura::Window* window) {
302 window->RemoveObserver(this); 328 window->RemoveObserver(this);
303 } 329 }
304 330
305 } // namespace ash 331 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698