| 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_COMMON_WM_WINDOW_CYCLE_LIST_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ | 6 #define ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 bool empty() const { return windows_.empty(); } | 36 bool empty() const { return windows_.empty(); } |
| 37 | 37 |
| 38 // Cycles to the next or previous window based on |direction|. | 38 // Cycles to the next or previous window based on |direction|. |
| 39 void Step(WindowCycleController::Direction direction); | 39 void Step(WindowCycleController::Direction direction); |
| 40 | 40 |
| 41 int current_index() const { return current_index_; } | 41 int current_index() const { return current_index_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 friend class WindowCycleControllerTest; | 44 friend class WindowCycleControllerTest; |
| 45 |
| 46 static void DisableInitialDelayForTesting(); |
| 47 |
| 45 const WindowList& windows() const { return windows_; } | 48 const WindowList& windows() const { return windows_; } |
| 46 | 49 |
| 47 // WmWindowObserver overrides: | 50 // WmWindowObserver overrides: |
| 48 // There is a chance a window is destroyed, for example by JS code. We need to | 51 // There is a chance a window is destroyed, for example by JS code. We need to |
| 49 // take care of that even if it is not intended for the user to close a window | 52 // take care of that even if it is not intended for the user to close a window |
| 50 // while window cycling. | 53 // while window cycling. |
| 51 void OnWindowDestroying(WmWindow* window) override; | 54 void OnWindowDestroying(WmWindow* window) override; |
| 52 | 55 |
| 53 // Returns true if the window list overlay should be shown. | 56 // Returns true if the window list overlay should be shown. |
| 54 bool ShouldShowUi(); | 57 bool ShouldShowUi(); |
| 55 | 58 |
| 56 // Initializes and shows |cycle_view_|. | 59 // Initializes and shows |cycle_view_|. |
| 57 void InitWindowCycleView(); | 60 void InitWindowCycleView(); |
| 58 | 61 |
| 59 // List of weak pointers to windows to use while cycling with the keyboard. | 62 // List of weak pointers to windows to use while cycling with the keyboard. |
| 60 // List is built when the user initiates the gesture (i.e. hits alt-tab the | 63 // List is built when the user initiates the gesture (i.e. hits alt-tab the |
| 61 // first time) and is emptied when the gesture is complete (i.e. releases the | 64 // first time) and is emptied when the gesture is complete (i.e. releases the |
| 62 // alt key). | 65 // alt key). |
| 63 WindowList windows_; | 66 WindowList windows_; |
| 64 | 67 |
| 65 // Current position in the |windows_|. Can be used to query selection depth, | 68 // Current position in the |windows_|. Can be used to query selection depth, |
| 66 // i.e., the position of an active window in a global MRU ordering. | 69 // i.e., the position of an active window in a global MRU ordering. |
| 67 int current_index_; | 70 int current_index_; |
| 68 | 71 |
| 69 // Wrapper for the window brought to the front. | 72 // Wrapper for the window brought to the front. |
| 73 // TODO(estade): remove ScopedShowWindow when we know we are happy launching |
| 74 // the |cycle_view_| version. |
| 70 std::unique_ptr<ScopedShowWindow> showing_window_; | 75 std::unique_ptr<ScopedShowWindow> showing_window_; |
| 71 | 76 |
| 72 // The top level View for the window cycle UI. May be null if the UI is not | 77 // The top level View for the window cycle UI. May be null if the UI is not |
| 73 // showing. | 78 // showing. |
| 74 WindowCycleView* cycle_view_; | 79 WindowCycleView* cycle_view_; |
| 75 | 80 |
| 76 // The widget that hosts the window cycle UI. | 81 // The widget that hosts the window cycle UI. |
| 77 std::unique_ptr<views::Widget> cycle_ui_widget_; | 82 std::unique_ptr<views::Widget> cycle_ui_widget_; |
| 78 | 83 |
| 79 // A timer to delay showing the UI. Quick Alt+Tab should not flash a UI. | 84 // A timer to delay showing the UI. Quick Alt+Tab should not flash a UI. |
| 80 base::OneShotTimer show_ui_timer_; | 85 base::OneShotTimer show_ui_timer_; |
| 81 | 86 |
| 82 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); | 87 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); |
| 83 }; | 88 }; |
| 84 | 89 |
| 85 } // namespace ash | 90 } // namespace ash |
| 86 | 91 |
| 87 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ | 92 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ |
| OLD | NEW |