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