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