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

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

Issue 22778002: Revert 216874 - Use overview mode for alt-tab cycling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/wm/window_selector.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SELECTOR_H_ 5 #ifndef ASH_WM_WINDOW_SELECTOR_H_
6 #define ASH_WM_WINDOW_SELECTOR_H_ 6 #define ASH_WM_WINDOW_SELECTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h"
13 #include "ui/aura/window_observer.h" 11 #include "ui/aura/window_observer.h"
14 #include "ui/base/events/event_handler.h" 12 #include "ui/base/events/event_handler.h"
15 #include "ui/gfx/transform.h" 13 #include "ui/gfx/transform.h"
16 14
17 namespace aura { 15 namespace aura {
18 class RootWindow; 16 class RootWindow;
19 } 17 }
20 18
21 namespace ui {
22 class LocatedEvent;
23 }
24
25 namespace views {
26 class Widget;
27 }
28
29 namespace ash { 19 namespace ash {
30 20
31 class WindowSelectorDelegate; 21 class WindowSelectorDelegate;
32 class WindowSelectorWindow;
33 22
34 // The WindowSelector shows a grid of all of your windows and allows selecting 23 // The WindowSelector shows a grid of all of your windows and allows selecting
35 // a window by clicking or tapping on it (OVERVIEW mode) or by alt-tabbing to 24 // a window by clicking or tapping on it.
36 // it (CYCLE mode).
37 class WindowSelector : public ui::EventHandler, 25 class WindowSelector : public ui::EventHandler,
38 public aura::WindowObserver { 26 public aura::WindowObserver {
39 public: 27 public:
40 enum Direction {
41 FORWARD,
42 BACKWARD
43 };
44 enum Mode {
45 CYCLE,
46 OVERVIEW
47 };
48
49 typedef std::vector<aura::Window*> WindowList; 28 typedef std::vector<aura::Window*> WindowList;
50 29
51 WindowSelector(const WindowList& windows, 30 WindowSelector(const WindowList& windows,
52 Mode mode,
53 WindowSelectorDelegate* delegate); 31 WindowSelectorDelegate* delegate);
54 virtual ~WindowSelector(); 32 virtual ~WindowSelector();
55 33
56 // Step to the next window in |direction|.
57 void Step(Direction direction);
58
59 // Select the current window.
60 void SelectWindow();
61
62 Mode mode() { return mode_; }
63
64 // ui::EventHandler: 34 // ui::EventHandler:
65 virtual void OnEvent(ui::Event* event) OVERRIDE; 35 virtual void OnEvent(ui::Event* event) OVERRIDE;
66 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 36 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
67 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 37 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
68 38
69 // aura::WindowObserver: 39 // aura::WindowObserver:
70 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; 40 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
71 41
72 private: 42 private:
73 // Returns the target of |event| or NULL if the event is not targeted at 43 struct WindowDetails {
74 // any of the windows in the selector. 44 WindowDetails() : window(NULL), minimized(false) {}
75 WindowSelectorWindow* GetEventTarget(ui::LocatedEvent* event);
76 45
77 // Handles a selection event for |target|. 46 bool operator==(const aura::Window* other_window) const {
78 void HandleSelectionEvent(WindowSelectorWindow* target); 47 return window == other_window;
48 }
79 49
80 // Position all of the windows based on the current selection mode. 50 // A weak pointer to the window.
51 aura::Window* window;
52
53 // If true, the window was minimized and this should be restored if the
54 // window was not selected.
55 bool minimized;
56
57 // The original transform of the window before entering overview mode.
58 gfx::Transform original_transform;
59 };
60
61 void HandleSelectionEvent(ui::Event* event);
81 void PositionWindows(); 62 void PositionWindows();
82 // Position all of the windows from |root_window| on |root_window|. 63 void PositionWindowsOnRoot(aura::RootWindow* root_window);
83 void PositionWindowsFromRoot(aura::RootWindow* root_window);
84 // Position all of the |windows| to fit on the |root_window|.
85 void PositionWindowsOnRoot(aura::RootWindow* root_window,
86 const std::vector<WindowSelectorWindow*>& windows);
87 64
88 void InitializeSelectionWidget(); 65 void SelectWindow(aura::Window*);
89 66
90 // Updates the selection widget's location to the currently selected window. 67 // List of weak pointers of windows to select from.
91 // If |animate| the transition to the new location is animated. 68 std::vector<WindowDetails> windows_;
92 void UpdateSelectionLocation(bool animate);
93
94 // The collection of windows in the overview wrapped by a helper class which
95 // restores their state and helps transform them to other root windows.
96 ScopedVector<WindowSelectorWindow> windows_;
97
98 // The window selection mode.
99 Mode mode_;
100 69
101 // Weak pointer to the selector delegate which will be called when a 70 // Weak pointer to the selector delegate which will be called when a
102 // selection is made. 71 // selection is made.
103 WindowSelectorDelegate* delegate_; 72 WindowSelectorDelegate* delegate_;
104 73
105 // Index of the currently selected window if the mode is CYCLE.
106 size_t selected_window_;
107
108 // Widget indicating which window is currently selected.
109 scoped_ptr<views::Widget> selection_widget_;
110
111 // In CYCLE mode, the root window in which selection is taking place.
112 // NULL otherwise.
113 aura::RootWindow* selection_root_;
114
115 DISALLOW_COPY_AND_ASSIGN(WindowSelector); 74 DISALLOW_COPY_AND_ASSIGN(WindowSelector);
116 }; 75 };
117 76
118 } // namespace ash 77 } // namespace ash
119 78
120 #endif // ASH_WM_WINDOW_SELECTOR_H_ 79 #endif // ASH_WM_WINDOW_SELECTOR_H_
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/wm/window_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698