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

Side by Side Diff: ash/wm/window_selector_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: Remove implicit cast to bool. Created 7 years, 4 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
« no previous file with comments | « ash/wm/window_selector_controller.h ('k') | ash/wm/window_selector_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/wm/window_selector_controller.h"
6
7 #include "ash/session_state_delegate.h"
8 #include "ash/shell.h"
9 #include "ash/wm/mru_window_tracker.h"
10 #include "ash/wm/window_selector.h"
11 #include "ash/wm/window_util.h"
12
13 namespace ash {
14
15 WindowSelectorController::WindowSelectorController() {
16 }
17
18 WindowSelectorController::~WindowSelectorController() {
19 }
20
21 // static
22 bool WindowSelectorController::CanSelect() {
23 // Don't allow a window overview if the screen is locked or a modal dialog is
24 // open.
25 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
26 !Shell::GetInstance()->IsSystemModalWindowOpen();
27 }
28
29 void WindowSelectorController::ToggleOverview() {
30 if (window_selector_.get()) {
31 window_selector_.reset();
32 } else {
33 std::vector<aura::Window*> windows = ash::Shell::GetInstance()->
34 mru_window_tracker()->BuildMruWindowList();
35 // Don't enter overview mode with no windows.
36 if (windows.empty())
37 return;
38
39 // Deactivating the window will hide popup windows like the omnibar or
40 // open menus.
41 aura::Window* active_window = wm::GetActiveWindow();
42 if (active_window)
43 wm::DeactivateWindow(active_window);
44 window_selector_.reset(new WindowSelector(windows, this));
45 }
46 }
47
48 bool WindowSelectorController::IsSelecting() {
49 return window_selector_.get() != NULL;
50 }
51
52 void WindowSelectorController::OnWindowSelected(aura::Window* window) {
53 window_selector_.reset();
54 wm::ActivateWindow(window);
55 }
56
57 void WindowSelectorController::OnSelectionCanceled() {
58 window_selector_.reset();
59 }
60
61 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_selector_controller.h ('k') | ash/wm/window_selector_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698