OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
tdanderson
2014/05/01 18:51:39
Make sure you have the right headers for new files
Nina
2014/05/01 20:41:16
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | |
6 #define ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 | |
12 namespace ui { | |
13 class EventHandler; | |
14 } | |
15 | |
16 namespace ash { | |
17 | |
18 class WindowCycleList; | |
19 | |
20 // Controls cycling through windows with the keyboard, for example, via alt-tab. | |
tdanderson
2014/05/01 18:51:39
"for example" -> this implies that there are other
Nina
2014/05/01 20:41:16
Ah, I forgot to update the comments. The previous
| |
21 // Windows are sorted primarily by most recently used, and then by screen order. | |
22 // We activate windows as you cycle through them, so the order on the screen | |
23 // may change during the gesture, but the most recently used list isn't updated | |
24 // until the cycling ends. Thus we maintain the state of the windows | |
25 // at the beginning of the gesture so you can cycle through in a consistent | |
26 // order. | |
27 class ASH_EXPORT WindowCycleController { | |
28 public: | |
29 enum Direction { | |
tdanderson
2014/05/01 18:51:39
It feels unnecessary to define identical enums in
Nina
2014/05/01 20:41:16
Done.
| |
30 FORWARD, | |
31 BACKWARD | |
32 }; | |
33 WindowCycleController(); | |
34 virtual ~WindowCycleController(); | |
35 | |
36 // Returns true if cycling through windows is enabled. This is false at | |
37 // certain times, such as when the lock screen is visible. | |
38 static bool CanCycle(); | |
39 | |
40 // Cycles between windows in the given |direction|. If |is_alt_down| then | |
tdanderson
2014/05/01 18:51:39
You mention |is_alt_down| in this comment, but I d
Nina
2014/05/01 20:41:16
My bad, again, I removed that boolean because we n
| |
41 // interprets this call as the start of a multi-step cycle sequence and | |
42 // installs a key filter to watch for alt being released. | |
43 void HandleCycleWindow(Direction direction); | |
44 | |
45 // Cycles between windows without maintaining a multi-step cycle sequence | |
tdanderson
2014/05/01 18:51:39
I don't understand what a "multi-step cycle sequen
Nina
2014/05/01 20:41:16
Sorry, this function should be removed, it was use
| |
46 // (see above). | |
tdanderson
2014/05/01 18:51:39
Avoid saying above/below in comments, since the or
Nina
2014/05/01 20:41:16
Gotcha.
| |
47 void HandleLinearCycleWindow(); | |
tdanderson
2014/05/01 18:51:39
I don't see where HandleLinearCycleWindow() is cal
Nina
2014/05/01 20:41:16
It was used when you could cycle between
windows w
| |
48 | |
49 // Informs the controller that the Alt key has been released and it can | |
50 // terminate the existing multi-step cycle. | |
51 void AltKeyReleased(); | |
52 | |
53 // Returns true if we are in the middle of a window cycling gesture. | |
54 bool IsCycling() const { return windows_.get() != NULL; } | |
55 | |
56 // Returns the WindowCycleList. Really only useful for testing. | |
57 const WindowCycleList* windows() const { return windows_.get(); } | |
58 | |
59 private: | |
60 // Call to start cycling windows. You must call StopCycling() when done. | |
tdanderson
2014/05/01 18:51:39
"You must call" implies that you're expecting anot
Nina
2014/05/01 20:41:16
Done.
| |
61 void StartCycling(); | |
62 | |
63 // Cycles to the next or previous window based on |direction|. | |
64 void Step(Direction direction); | |
65 | |
66 // Installs an event filter to watch for release of the alt key. | |
67 void InstallEventFilter(); | |
68 | |
69 // Stops the current window cycle and cleans up the event filter. | |
tdanderson
2014/05/01 18:51:39
"cleans up" -> "removes"
Nina
2014/05/01 20:41:16
Done.
| |
70 void StopCycling(); | |
71 | |
72 scoped_ptr<WindowCycleList> windows_; | |
tdanderson
2014/05/01 18:51:39
I'd prefer this to be called window_cycle_list_ or
Nina
2014/05/01 20:41:16
Done.
| |
73 | |
74 // Event handler to watch for release of alt key. | |
75 scoped_ptr<ui::EventHandler> event_handler_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); | |
78 }; | |
79 | |
80 } // namespace ash | |
81 | |
82 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ | |
OLD | NEW |