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