OLD | NEW |
---|---|
(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/window_cycle_controller.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 = | |
34 WindowCycleController::BuildWindowList(NULL, false); | |
flackr
2013/07/29 15:38:37
This will change to the window tracker MRU list wh
| |
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 void WindowSelectorController::SelectWindow(aura::Window* window) { | |
49 window_selector_.reset(); | |
50 wm::ActivateWindow(window); | |
sky
2013/07/30 16:39:19
Does this do the right thing if window was minimiz
flackr
2013/07/31 20:06:12
Added call to Show to set correct state (consisten
| |
51 // TODO(flackr): Ensure window gets added to MRU windows used for | |
52 // BuildWindowList. | |
53 } | |
54 | |
55 } // namespace ash | |
OLD | NEW |