OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CYCLE_CONTROLLER_H_ | 5 #ifndef ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ |
6 #define ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | 6 #define ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // Returns true if cycling through windows is enabled. This is false at | 52 // Returns true if cycling through windows is enabled. This is false at |
53 // certain times, such as when the lock screen is visible. | 53 // certain times, such as when the lock screen is visible. |
54 static bool CanCycle(); | 54 static bool CanCycle(); |
55 | 55 |
56 // Cycles between windows in the given |direction|. If |is_alt_down| then | 56 // Cycles between windows in the given |direction|. If |is_alt_down| then |
57 // interprets this call as the start of a multi-step cycle sequence and | 57 // interprets this call as the start of a multi-step cycle sequence and |
58 // installs a key filter to watch for alt being released. | 58 // installs a key filter to watch for alt being released. |
59 void HandleCycleWindow(Direction direction, bool is_alt_down); | 59 void HandleCycleWindow(Direction direction, bool is_alt_down); |
60 | 60 |
| 61 // Cycles between windows without maintaining a multi-step cycle sequence |
| 62 // (see above). |
| 63 void HandleLinearCycleWindow(); |
| 64 |
61 // Informs the controller that the Alt key has been released and it can | 65 // Informs the controller that the Alt key has been released and it can |
62 // terminate the existing multi-step cycle. | 66 // terminate the existing multi-step cycle. |
63 void AltKeyReleased(); | 67 void AltKeyReleased(); |
64 | 68 |
65 // Returns true if we are in the middle of a window cycling gesture. | 69 // Returns true if we are in the middle of a window cycling gesture. |
66 bool IsCycling() const { return windows_.get() != NULL; } | 70 bool IsCycling() const { return windows_.get() != NULL; } |
67 | 71 |
68 // Returns the WindowCycleList. Really only useful for testing. | 72 // Returns the WindowCycleList. Really only useful for testing. |
69 const WindowCycleList* windows() const { return windows_.get(); } | 73 const WindowCycleList* windows() const { return windows_.get(); } |
70 | 74 |
71 // Set up the observers to handle window changes for the containers we care | 75 // Set up the observers to handle window changes for the containers we care |
72 // about. Called when a new root window is added. | 76 // about. Called when a new root window is added. |
73 void OnRootWindowAdded(aura::RootWindow* root_window); | 77 void OnRootWindowAdded(aura::RootWindow* root_window); |
74 | 78 |
75 // Returns the set of windows to cycle through. This method creates | 79 // Returns the set of windows to cycle through. This method creates |
76 // the vector based on the current set of windows across all valid root | 80 // the vector based on the current set of windows across all valid root |
77 // windows. As a result it is not necessarily the same as the set of | 81 // windows. As a result it is not necessarily the same as the set of |
78 // windows being iterated over. | 82 // windows being iterated over. |
79 // If |mru_windows| is not NULL, windows in this list are put at the head of | 83 // If |mru_windows| is not NULL, windows in this list are put at the head of |
80 // the window list. | 84 // the window list. |
| 85 // If |top_most_at_end| the window list will return in ascending order instead |
| 86 // of the default descending. |
81 static std::vector<aura::Window*> BuildWindowList( | 87 static std::vector<aura::Window*> BuildWindowList( |
82 const std::list<aura::Window*>* mru_windows); | 88 const std::list<aura::Window*>* mru_windows, |
| 89 bool top_most_at_end); |
83 | 90 |
84 private: | 91 private: |
85 // Call to start cycling windows. You must call StopCycling() when done. | 92 // Call to start cycling windows. You must call StopCycling() when done. |
86 void StartCycling(); | 93 void StartCycling(); |
87 | 94 |
88 // Cycles to the next or previous window based on |direction|. | 95 // Cycles to the next or previous window based on |direction|. |
89 void Step(Direction direction); | 96 void Step(Direction direction); |
90 | 97 |
91 // Installs an event filter to watch for release of the alt key. | 98 // Installs an event filter to watch for release of the alt key. |
92 void InstallEventFilter(); | 99 void InstallEventFilter(); |
(...skipping 23 matching lines...) Expand all Loading... |
116 std::list<aura::Window*> mru_windows_; | 123 std::list<aura::Window*> mru_windows_; |
117 | 124 |
118 aura::client::ActivationClient* activation_client_; | 125 aura::client::ActivationClient* activation_client_; |
119 | 126 |
120 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); | 127 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); |
121 }; | 128 }; |
122 | 129 |
123 } // namespace ash | 130 } // namespace ash |
124 | 131 |
125 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | 132 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ |
OLD | NEW |