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

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

Issue 10700057: Add always on top windows to the alt+tab list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use most recently used windows. Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list>
8 #include <vector> 9 #include <vector>
9 10
10 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/client/activation_change_observer.h"
13 15
14 namespace aura { 16 namespace aura {
15 class EventFilter; 17 class EventFilter;
16 class Window; 18 class Window;
17 } 19 }
18 20
19 namespace ash { 21 namespace ash {
20 22
21 class WindowCycleList; 23 class WindowCycleList;
22 24
23 // Controls cycling through windows with the keyboard, for example, via alt-tab. 25 // Controls cycling through windows with the keyboard, for example, via alt-tab.
24 // We activate windows as you cycle through them, so the order on the screen 26 // We activate windows as you cycle through them, so the order on the screen
25 // may change during the gesture. Thus we maintain the state of the windows 27 // may change during the gesture. Thus we maintain the state of the windows
sky 2012/07/19 16:41:15 Update description to reflect changes.
Zachary Kuznia 2012/07/23 22:44:33 Done.
26 // 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
27 // order. 29 // order.
28 class ASH_EXPORT WindowCycleController { 30 class ASH_EXPORT WindowCycleController
31 : public aura::client::ActivationChangeObserver {
29 public: 32 public:
30 enum Direction { 33 enum Direction {
31 FORWARD, 34 FORWARD,
32 BACKWARD 35 BACKWARD
33 }; 36 };
34 WindowCycleController(); 37 WindowCycleController();
35 ~WindowCycleController(); 38 ~WindowCycleController();
36 39
37 // Returns true if cycling through windows is enabled. This is false at 40 // Returns true if cycling through windows is enabled. This is false at
38 // certain times, such as when the lock screen is visible. 41 // certain times, such as when the lock screen is visible.
(...skipping 11 matching lines...) Expand all
50 // Returns true if we are in the middle of a window cycling gesture. 53 // Returns true if we are in the middle of a window cycling gesture.
51 bool IsCycling() const { return windows_.get() != NULL; } 54 bool IsCycling() const { return windows_.get() != NULL; }
52 55
53 // Returns the WindowCycleList. Really only useful for testing. 56 // Returns the WindowCycleList. Really only useful for testing.
54 const WindowCycleList* windows() const { return windows_.get(); } 57 const WindowCycleList* windows() const { return windows_.get(); }
55 58
56 // Returns the set of windows to cycle through. This method creates 59 // Returns the set of windows to cycle through. This method creates
57 // the vector based on the current set of windows across all valid root 60 // the vector based on the current set of windows across all valid root
58 // windows. As a result it is not necessarily the same as the set of 61 // windows. As a result it is not necessarily the same as the set of
59 // windows being iterated over. 62 // windows being iterated over.
60 static std::vector<aura::Window*> BuildWindowList(); 63 // If |mru_windows| is not NULL, windows in this list are put at the head of
64 // the window list.
65 static std::vector<aura::Window*> BuildWindowList(
66 std::list<aura::Window*>* mru_windows);
61 67
62 private: 68 private:
63 // Call to start cycling windows. You must call StopCycling() when done. 69 // Call to start cycling windows. You must call StopCycling() when done.
64 void StartCycling(); 70 void StartCycling();
65 71
66 // Cycles to the next or previous window based on |direction|. 72 // Cycles to the next or previous window based on |direction|.
67 void Step(Direction direction); 73 void Step(Direction direction);
68 74
69 // Installs an event filter to watch for release of the alt key. 75 // Installs an event filter to watch for release of the alt key.
70 void InstallEventFilter(); 76 void InstallEventFilter();
71 77
72 // Stops the current window cycle and cleans up the event filter. 78 // Stops the current window cycle and cleans up the event filter.
73 void StopCycling(); 79 void StopCycling();
74 80
81 // Overridden from ActivationChangeObserver:
82 virtual void OnWindowActivated(aura::Window* active,
83 aura::Window* old_active) OVERRIDE;
84
75 scoped_ptr<WindowCycleList> windows_; 85 scoped_ptr<WindowCycleList> windows_;
76 86
77 // Event filter to watch for release of alt key. 87 // Event filter to watch for release of alt key.
78 scoped_ptr<aura::EventFilter> event_filter_; 88 scoped_ptr<aura::EventFilter> event_filter_;
79 89
90 std::list<aura::Window*> mru_windows_;
Daniel Erat 2012/07/19 15:14:17 nit: add a comment describing what this is (e.g. o
Zachary Kuznia 2012/07/23 22:44:33 Done.
91
92 bool mru_ignore_;
Daniel Erat 2012/07/19 15:14:17 nit: add a comment describing what this is
Zachary Kuznia 2012/07/23 22:44:33 Done.
93
80 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); 94 DISALLOW_COPY_AND_ASSIGN(WindowCycleController);
81 }; 95 };
82 96
83 } // namespace ash 97 } // namespace ash
84 98
85 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ 99 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698