Index: ash/wm/window_selector_controller.cc |
diff --git a/ash/wm/window_selector_controller.cc b/ash/wm/window_selector_controller.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..69fcd7dd04c381ed1381563b307771382d0a2a7a |
--- /dev/null |
+++ b/ash/wm/window_selector_controller.cc |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/wm/window_selector_controller.h" |
+ |
+#include "ash/session_state_delegate.h" |
+#include "ash/shell.h" |
+#include "ash/wm/window_cycle_controller.h" |
+#include "ash/wm/window_selector.h" |
+#include "ash/wm/window_util.h" |
+ |
+namespace ash { |
+ |
+WindowSelectorController::WindowSelectorController() { |
+} |
+ |
+WindowSelectorController::~WindowSelectorController() { |
+} |
+ |
+// static |
+bool WindowSelectorController::CanSelect() { |
+ // Don't allow a window overview if the screen is locked or a modal dialog is |
+ // open. |
+ return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && |
+ !Shell::GetInstance()->IsSystemModalWindowOpen(); |
+} |
+ |
+void WindowSelectorController::ToggleOverview() { |
+ if (window_selector_.get()) { |
+ window_selector_.reset(); |
+ } else { |
+ std::vector<aura::Window*> windows = |
+ WindowCycleController::BuildWindowList(NULL, false); |
flackr
2013/07/29 15:38:37
This will change to the window tracker MRU list wh
|
+ // Don't enter overview mode with no windows. |
+ if (windows.empty()) |
+ return; |
+ |
+ // Deactivating the window will hide popup windows like the omnibar or |
+ // open menus. |
+ aura::Window* active_window = wm::GetActiveWindow(); |
+ if (active_window) |
+ wm::DeactivateWindow(active_window); |
+ window_selector_.reset(new WindowSelector(windows, this)); |
+ } |
+} |
+ |
+void WindowSelectorController::SelectWindow(aura::Window* window) { |
+ window_selector_.reset(); |
+ 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
|
+ // TODO(flackr): Ensure window gets added to MRU windows used for |
+ // BuildWindowList. |
+} |
+ |
+} // namespace ash |