1 // Copyright 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 #ifndef ASH_WM_WINDOW_SELECTOR_CONTROLLER_H_ 6 #define ASH_WM_WINDOW_SELECTOR_CONTROLLER_H_ 7 8 #include <list> 9 #include <vector> 10 11 #include "ash/ash_export.h" 12 #include "ash/wm/window_selector.h" 13 #include "ash/wm/window_selector_delegate.h" 14 #include "base/basictypes.h" 15 #include "base/memory/scoped_ptr.h" 16 #include "ui/aura/window_observer.h" 17 18 namespace aura { 19 class Window; 20 } 21 22 namespace ui { 23 class EventHandler; 24 } 25 26 namespace ash { 27 28 class WindowSelector; 29 30 // Manages a window selector which displays an overview of all windows and 31 // allows selecting a window to activate it. 32 class ASH_EXPORT WindowSelectorController 33 : public WindowSelectorDelegate { 34 public: 35 WindowSelectorController(); 36 virtual ~WindowSelectorController(); 37 38 // Returns true if selecting windows in an overview is enabled. This is false 39 // at certain times, such as when the lock screen is visible. 40 static bool CanSelect(); 41 42 // Enters overview mode. This is essentially the window cycling mode however 43 // not released on releasing the alt key and allows selecting with the mouse 44 // or touch rather than keypresses. 45 void ToggleOverview(); 46 47 // Cycles between windows in the given |direction|. It is assumed that the 48 // alt key is held down and a key filter is installed to watch for alt being 49 // released. 50 void HandleCycleWindow(WindowSelector::Direction direction); 51 52 // Informs the controller that the Alt key has been released and it can 53 // terminate the existing multi-step cycle. 54 void AltKeyReleased(); 55 56 // Returns true if window selection mode is active. 57 bool IsSelecting(); 58 59 // WindowSelectorDelegate: 60 virtual void OnWindowSelected(aura::Window* window) OVERRIDE; 61 virtual void OnSelectionCanceled() OVERRIDE; 62 63 private: 64 scoped_ptr<WindowSelector> window_selector_; 65 scoped_ptr<ui::EventHandler> event_handler_; 66 67 DISALLOW_COPY_AND_ASSIGN(WindowSelectorController); 68 }; 69 70 } // namespace ash 71 72 #endif // ASH_WM_WINDOW_SELECTOR_CONTROLLER_H_ 73