| 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_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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class EventHandler; | 15 class EventHandler; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace aura { | |
| 19 class Window; | |
| 20 } // namespace aura | |
| 21 | |
| 22 namespace ash { | 18 namespace ash { |
| 23 | 19 |
| 24 class WindowCycleList; | 20 class WindowCycleList; |
| 21 class WmWindow; |
| 25 | 22 |
| 26 // Controls cycling through windows with the keyboard via alt-tab. | 23 // Controls cycling through windows with the keyboard via alt-tab. |
| 27 // Windows are sorted primarily by most recently used, and then by screen order. | 24 // Windows are sorted primarily by most recently used, and then by screen order. |
| 28 // We activate windows as you cycle through them, so the order on the screen | 25 // We activate windows as you cycle through them, so the order on the screen |
| 29 // may change during the gesture, but the most recently used list isn't updated | 26 // may change during the gesture, but the most recently used list isn't updated |
| 30 // until the cycling ends. Thus we maintain the state of the windows | 27 // until the cycling ends. Thus we maintain the state of the windows |
| 31 // at the beginning of the gesture so you can cycle through in a consistent | 28 // at the beginning of the gesture so you can cycle through in a consistent |
| 32 // order. | 29 // order. |
| 33 class ASH_EXPORT WindowCycleController { | 30 class ASH_EXPORT WindowCycleController { |
| 34 public: | 31 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 63 } | 60 } |
| 64 | 61 |
| 65 private: | 62 private: |
| 66 // Cycles to the next or previous window based on |direction|. | 63 // Cycles to the next or previous window based on |direction|. |
| 67 void Step(Direction direction); | 64 void Step(Direction direction); |
| 68 | 65 |
| 69 std::unique_ptr<WindowCycleList> window_cycle_list_; | 66 std::unique_ptr<WindowCycleList> window_cycle_list_; |
| 70 | 67 |
| 71 // Tracks what Window was active when starting to cycle and used to determine | 68 // Tracks what Window was active when starting to cycle and used to determine |
| 72 // if the active Window changed in when ending cycling. | 69 // if the active Window changed in when ending cycling. |
| 73 aura::Window* active_window_before_window_cycle_ = nullptr; | 70 WmWindow* active_window_before_window_cycle_ = nullptr; |
| 74 | 71 |
| 75 // Event handler to watch for release of alt key. | 72 // Event handler to watch for release of alt key. |
| 76 std::unique_ptr<ui::EventHandler> event_handler_; | 73 std::unique_ptr<ui::EventHandler> event_handler_; |
| 77 | 74 |
| 78 base::Time cycle_start_time_; | 75 base::Time cycle_start_time_; |
| 79 | 76 |
| 80 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); | 77 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); |
| 81 }; | 78 }; |
| 82 | 79 |
| 83 } // namespace ash | 80 } // namespace ash |
| 84 | 81 |
| 85 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | 82 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ |
| OLD | NEW |