Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: ash/wm/window_cycle_controller.h

Issue 260883005: Separated alt-tab window cycle from overview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed CL issues Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
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 via alt-tab.
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 {
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|.
41 void HandleCycleWindow(Direction direction);
42
43 // Informs the controller that the Alt key has been released and it can
44 // terminate the existing multi-step cycle.
45 void AltKeyReleased();
46
47 // Returns true if we are in the middle of a window cycling gesture.
48 bool IsCycling() const { return window_cycle_list_.get() != NULL; }
49
50 // Returns the WindowCycleList. Really only useful for testing.
51 const WindowCycleList* window_cycle_list()
52 const { return window_cycle_list_.get(); }
tdanderson 2014/05/01 21:58:33 Change formatting: const WindowCycleList* window_
Nina 2014/05/02 13:27:34 Done.
53
54 private:
55 // Call to start cycling windows.
tdanderson 2014/05/01 21:58:33 Also mention that this function adds the pre-targe
Nina 2014/05/02 13:27:34 Done.
56 void StartCycling();
57
58 // Cycles to the next or previous window based on |direction|.
59 void Step(Direction direction);
60
61 // Stops the current window cycle and removes the event filter.
62 void StopCycling();
63
64 scoped_ptr<WindowCycleList> window_cycle_list_;
65
66 // Event handler to watch for release of alt key.
67 scoped_ptr<ui::EventHandler> event_handler_;
68
69 DISALLOW_COPY_AND_ASSIGN(WindowCycleController);
70 };
71
72 } // namespace ash
73
74 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698