OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LIST_H_ | 5 #ifndef ASH_WM_WINDOW_CYCLE_LIST_H_ |
6 #define ASH_WM_WINDOW_CYCLE_LIST_H_ | 6 #define ASH_WM_WINDOW_CYCLE_LIST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 using WindowList = std::vector<WmWindow*>; | 24 using WindowList = std::vector<WmWindow*>; |
25 | 25 |
26 explicit WindowCycleList(const WindowList& windows); | 26 explicit WindowCycleList(const WindowList& windows); |
27 ~WindowCycleList() override; | 27 ~WindowCycleList() override; |
28 | 28 |
29 bool empty() const { return windows_.empty(); } | 29 bool empty() const { return windows_.empty(); } |
30 | 30 |
31 // Cycles to the next or previous window based on |direction|. | 31 // Cycles to the next or previous window based on |direction|. |
32 void Step(WindowCycleController::Direction direction); | 32 void Step(WindowCycleController::Direction direction); |
33 | 33 |
| 34 int current_index() const { return current_index_; } |
| 35 |
34 private: | 36 private: |
35 friend class WindowCycleControllerTest; | 37 friend class WindowCycleControllerTest; |
36 const WindowList& windows() const { return windows_; } | 38 const WindowList& windows() const { return windows_; } |
37 | 39 |
38 // aura::WindowObserver overrides: | 40 // aura::WindowObserver overrides: |
39 // There is a chance a window is destroyed, for example by JS code. We need to | 41 // There is a chance a window is destroyed, for example by JS code. We need to |
40 // take care of that even if it is not intended for the user to close a window | 42 // take care of that even if it is not intended for the user to close a window |
41 // while window cycling. | 43 // while window cycling. |
42 void OnWindowDestroying(WmWindow* window) override; | 44 void OnWindowDestroying(WmWindow* window) override; |
43 | 45 |
44 // List of weak pointers to windows to use while cycling with the keyboard. | 46 // List of weak pointers to windows to use while cycling with the keyboard. |
45 // List is built when the user initiates the gesture (i.e. hits alt-tab the | 47 // List is built when the user initiates the gesture (i.e. hits alt-tab the |
46 // first time) and is emptied when the gesture is complete (i.e. releases the | 48 // first time) and is emptied when the gesture is complete (i.e. releases the |
47 // alt key). | 49 // alt key). |
48 WindowList windows_; | 50 WindowList windows_; |
49 | 51 |
50 // Current position in the |windows_| | 52 // Current position in the |windows_|. Can be used to query selection depth, |
| 53 // i.e., the position of an active window in a global MRU ordering. |
51 int current_index_; | 54 int current_index_; |
52 | 55 |
53 // Wrapper for the window brought to the front. | 56 // Wrapper for the window brought to the front. |
54 std::unique_ptr<ScopedShowWindow> showing_window_; | 57 std::unique_ptr<ScopedShowWindow> showing_window_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); | 59 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); |
57 }; | 60 }; |
58 | 61 |
59 } // namespace ash | 62 } // namespace ash |
60 | 63 |
61 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_ | 64 #endif // ASH_WM_WINDOW_CYCLE_LIST_H_ |
OLD | NEW |