| 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 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/common/wm/window_cycle_controller.h" | 12 #include "ash/common/wm/window_cycle_controller.h" |
| 13 #include "ash/common/wm_window_observer.h" | 13 #include "ash/common/wm_window_observer.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/timer/timer.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class Label; | 18 class Label; |
| 18 class Widget; | 19 class Widget; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace ash { | 22 namespace ash { |
| 22 | 23 |
| 23 class ScopedShowWindow; | 24 class ScopedShowWindow; |
| 24 class WindowCycleView; | 25 class WindowCycleView; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 // WmWindowObserver overrides: | 47 // WmWindowObserver overrides: |
| 47 // There is a chance a window is destroyed, for example by JS code. We need to | 48 // There is a chance a window is destroyed, for example by JS code. We need to |
| 48 // take care of that even if it is not intended for the user to close a window | 49 // take care of that even if it is not intended for the user to close a window |
| 49 // while window cycling. | 50 // while window cycling. |
| 50 void OnWindowDestroying(WmWindow* window) override; | 51 void OnWindowDestroying(WmWindow* window) override; |
| 51 | 52 |
| 52 // Returns true if the window list overlay should be shown. | 53 // Returns true if the window list overlay should be shown. |
| 53 bool ShouldShowUi(); | 54 bool ShouldShowUi(); |
| 54 | 55 |
| 56 // Initializes and shows |cycle_view_|. |
| 57 void InitWindowCycleView(); |
| 58 |
| 55 // List of weak pointers to windows to use while cycling with the keyboard. | 59 // List of weak pointers to windows to use while cycling with the keyboard. |
| 56 // List is built when the user initiates the gesture (i.e. hits alt-tab the | 60 // List is built when the user initiates the gesture (i.e. hits alt-tab the |
| 57 // first time) and is emptied when the gesture is complete (i.e. releases the | 61 // first time) and is emptied when the gesture is complete (i.e. releases the |
| 58 // alt key). | 62 // alt key). |
| 59 WindowList windows_; | 63 WindowList windows_; |
| 60 | 64 |
| 61 // Current position in the |windows_|. Can be used to query selection depth, | 65 // Current position in the |windows_|. Can be used to query selection depth, |
| 62 // i.e., the position of an active window in a global MRU ordering. | 66 // i.e., the position of an active window in a global MRU ordering. |
| 63 int current_index_; | 67 int current_index_; |
| 64 | 68 |
| 65 // Wrapper for the window brought to the front. | 69 // Wrapper for the window brought to the front. |
| 66 std::unique_ptr<ScopedShowWindow> showing_window_; | 70 std::unique_ptr<ScopedShowWindow> showing_window_; |
| 67 | 71 |
| 68 // The top level View for the window cycle UI. May be null if the UI is not | 72 // The top level View for the window cycle UI. May be null if the UI is not |
| 69 // showing. | 73 // showing. |
| 70 WindowCycleView* cycle_view_; | 74 WindowCycleView* cycle_view_; |
| 71 | 75 |
| 72 // The widget that hosts the window cycle UI. | 76 // The widget that hosts the window cycle UI. |
| 73 std::unique_ptr<views::Widget> cycle_ui_widget_; | 77 std::unique_ptr<views::Widget> cycle_ui_widget_; |
| 74 | 78 |
| 79 // A timer to delay showing the UI. Quick Alt+Tab should not flash a UI. |
| 80 base::OneShotTimer show_ui_timer_; |
| 81 |
| 75 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); | 82 DISALLOW_COPY_AND_ASSIGN(WindowCycleList); |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 } // namespace ash | 85 } // namespace ash |
| 79 | 86 |
| 80 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ | 87 #endif // ASH_COMMON_WM_WINDOW_CYCLE_LIST_H_ |
| OLD | NEW |