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

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

Issue 11421194: Hook up the FocusController behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
« no previous file with comments | « ash/wm/shelf_layout_manager.cc ('k') | ash/wm/window_cycle_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/client/activation_change_observer.h"
15 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
15 #include "ui/views/corewm/activation_change_shim.h"
16 16
17 namespace aura { 17 namespace aura {
18 class RootWindow; 18 class RootWindow;
19 class Window; 19 class Window;
20 namespace client {
21 class ActivationClient;
22 }
20 } 23 }
21 24
22 namespace ui { 25 namespace ui {
23 class EventHandler; 26 class EventHandler;
24 } 27 }
25 28
26 namespace ash { 29 namespace ash {
27 30
28 namespace internal {
29 class ActivationController;
30 }
31
32 class WindowCycleList; 31 class WindowCycleList;
33 32
34 // Controls cycling through windows with the keyboard, for example, via alt-tab. 33 // Controls cycling through windows with the keyboard, for example, via alt-tab.
35 // Windows are sorted primarily by most recently used, and then by screen order. 34 // Windows are sorted primarily by most recently used, and then by screen order.
36 // We activate windows as you cycle through them, so the order on the screen 35 // We activate windows as you cycle through them, so the order on the screen
37 // may change during the gesture, but the most recently used list isn't updated 36 // may change during the gesture, but the most recently used list isn't updated
38 // until the cycling ends. Thus we maintain the state of the windows 37 // until the cycling ends. Thus we maintain the state of the windows
39 // at the beginning of the gesture so you can cycle through in a consistent 38 // at the beginning of the gesture so you can cycle through in a consistent
40 // order. 39 // order.
41 class ASH_EXPORT WindowCycleController 40 class ASH_EXPORT WindowCycleController
42 : public aura::client::ActivationChangeObserver, 41 : public views::corewm::ActivationChangeShim,
43 public aura::WindowObserver { 42 public aura::WindowObserver {
44 public: 43 public:
45 enum Direction { 44 enum Direction {
46 FORWARD, 45 FORWARD,
47 BACKWARD 46 BACKWARD
48 }; 47 };
49 explicit WindowCycleController( 48 explicit WindowCycleController(
50 internal::ActivationController* activation_controller); 49 aura::client::ActivationClient* activation_client);
51 virtual ~WindowCycleController(); 50 virtual ~WindowCycleController();
52 51
53 // Returns true if cycling through windows is enabled. This is false at 52 // Returns true if cycling through windows is enabled. This is false at
54 // certain times, such as when the lock screen is visible. 53 // certain times, such as when the lock screen is visible.
55 static bool CanCycle(); 54 static bool CanCycle();
56 55
57 // Cycles between windows in the given |direction|. If |is_alt_down| then 56 // Cycles between windows in the given |direction|. If |is_alt_down| then
58 // interprets this call as the start of a multi-step cycle sequence and 57 // interprets this call as the start of a multi-step cycle sequence and
59 // installs a key filter to watch for alt being released. 58 // installs a key filter to watch for alt being released.
60 void HandleCycleWindow(Direction direction, bool is_alt_down); 59 void HandleCycleWindow(Direction direction, bool is_alt_down);
(...skipping 30 matching lines...) Expand all
91 90
92 // Installs an event filter to watch for release of the alt key. 91 // Installs an event filter to watch for release of the alt key.
93 void InstallEventFilter(); 92 void InstallEventFilter();
94 93
95 // Stops the current window cycle and cleans up the event filter. 94 // Stops the current window cycle and cleans up the event filter.
96 void StopCycling(); 95 void StopCycling();
97 96
98 // Checks if the window represents a container whose children we track. 97 // Checks if the window represents a container whose children we track.
99 static bool IsTrackedContainer(aura::Window* window); 98 static bool IsTrackedContainer(aura::Window* window);
100 99
101 // Overridden from ActivationChangeObserver: 100 // Overridden from views::corewm::ActivationChangeShim:
102 virtual void OnWindowActivated(aura::Window* active, 101 virtual void OnWindowActivated(aura::Window* active,
103 aura::Window* old_active) OVERRIDE; 102 aura::Window* old_active) OVERRIDE;
104 103
105 // Overridden from WindowObserver: 104 // Overridden from WindowObserver:
106 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; 105 virtual void OnWindowAdded(aura::Window* window) OVERRIDE;
107 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; 106 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE;
108 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 107 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
109 108
110 scoped_ptr<WindowCycleList> windows_; 109 scoped_ptr<WindowCycleList> windows_;
111 110
112 // Event handler to watch for release of alt key. 111 // Event handler to watch for release of alt key.
113 scoped_ptr<ui::EventHandler> event_handler_; 112 scoped_ptr<ui::EventHandler> event_handler_;
114 113
115 // List of windows that have been activated in containers that we cycle 114 // List of windows that have been activated in containers that we cycle
116 // through, sorted by most recently used. 115 // through, sorted by most recently used.
117 std::list<aura::Window*> mru_windows_; 116 std::list<aura::Window*> mru_windows_;
118 117
119 internal::ActivationController* activation_controller_; 118 aura::client::ActivationClient* activation_client_;
120 119
121 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); 120 DISALLOW_COPY_AND_ASSIGN(WindowCycleController);
122 }; 121 };
123 122
124 } // namespace ash 123 } // namespace ash
125 124
126 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_ 125 #endif // ASH_WM_WINDOW_CYCLE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/wm/shelf_layout_manager.cc ('k') | ash/wm/window_cycle_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698