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

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

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified RemoveWindow() Created 6 years, 6 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
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_OVERVIEW_WINDOW_SELECTOR_H_ 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 namespace ui { 31 namespace ui {
32 class LocatedEvent; 32 class LocatedEvent;
33 } 33 }
34 34
35 namespace ash { 35 namespace ash {
36 class WindowSelectorDelegate; 36 class WindowSelectorDelegate;
37 class WindowSelectorItem; 37 class WindowSelectorItem;
38 class WindowSelectorTest; 38 class WindowSelectorTest;
39 class WindowGrid;
39 40
40 // The WindowSelector shows a grid of all of your windows, allowing to select 41 // The WindowSelector shows a grid of all of your windows, allowing to select
41 // one by clicking or tapping on it. 42 // one by clicking or tapping on it.
42 class ASH_EXPORT WindowSelector 43 class ASH_EXPORT WindowSelector
43 : public ui::EventHandler, 44 : public ui::EventHandler,
44 public gfx::DisplayObserver, 45 public gfx::DisplayObserver,
45 public aura::WindowObserver, 46 public aura::WindowObserver,
46 public aura::client::ActivationChangeObserver { 47 public aura::client::ActivationChangeObserver {
47 public: 48 public:
49 enum Direction {
50 RIGHT,
51 DOWN,
52 LEFT,
53 UP
54 };
55
48 typedef std::vector<aura::Window*> WindowList; 56 typedef std::vector<aura::Window*> WindowList;
49 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; 57 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList;
50 58
51 WindowSelector(const WindowList& windows, 59 WindowSelector(const WindowList& windows,
52 WindowSelectorDelegate* delegate); 60 WindowSelectorDelegate* delegate);
53 virtual ~WindowSelector(); 61 virtual ~WindowSelector();
54 62
55 // Cancels window selection. 63 // Cancels window selection.
56 void CancelSelection(); 64 void CancelSelection();
57 65
(...skipping 19 matching lines...) Expand all
77 virtual void OnAttemptToReactivateWindow( 85 virtual void OnAttemptToReactivateWindow(
78 aura::Window* request_active, 86 aura::Window* request_active,
79 aura::Window* actual_active) OVERRIDE; 87 aura::Window* actual_active) OVERRIDE;
80 88
81 private: 89 private:
82 friend class WindowSelectorTest; 90 friend class WindowSelectorTest;
83 91
84 // Begins positioning windows such that all windows are visible on the screen. 92 // Begins positioning windows such that all windows are visible on the screen.
85 void StartOverview(); 93 void StartOverview();
86 94
87 // Returns true if a window is contained in the overview, and therefore should 95 // Position all of the windows in the overview.
88 // not be hidden prior to entering overview mode. 96 void PositionWindows(bool animate);
89 bool Contains(const aura::Window* window);
90 97
91 // Position all of the windows based on the current selection mode. 98 // Creates the WindowGrid objects and populates them with the current windows.
92 void PositionWindows(bool animate); 99 void CreateWindowGrids();
93 // Position all of the windows from |root_window| on |root_window|.
94 void PositionWindowsFromRoot(aura::Window* root_window, bool animate);
95 100
96 // Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If 101 // Hide and track all hidden windows not in the overview item list.
97 // Hide and track all hidden windows not in overview. 102 void HideAndTrackNonOverviewWindows(
98 void HideAndTrackNonOverviewWindows(); 103 const std::vector<WindowSelectorItem*>& overview_items);
99 104
100 // |focus|, restores focus to the stored window. 105 // |focus|, restores focus to the stored window.
101 void ResetFocusRestoreWindow(bool focus); 106 void ResetFocusRestoreWindow(bool focus);
102 107
103 // The collection of items in the overview wrapped by a helper class which 108 // Helper function that moves the selection widget to |direction| on the
104 // restores their state and helps transform them to other root windows. 109 // corresponding window grid.
105 ScopedVector<WindowSelectorItem> windows_; 110 void Move(Direction direction);
111
112 // Returns the WindowSelectorItem
106 113
107 // Tracks observed windows. 114 // Tracks observed windows.
108 std::set<aura::Window*> observed_windows_; 115 std::set<aura::Window*> observed_windows_;
109 116
110 // Weak pointer to the selector delegate which will be called when a 117 // Weak pointer to the selector delegate which will be called when a
111 // selection is made. 118 // selection is made.
112 WindowSelectorDelegate* delegate_; 119 WindowSelectorDelegate* delegate_;
113 120
114 // A weak pointer to the window which was focused on beginning window 121 // A weak pointer to the window which was focused on beginning window
115 // selection. If window selection is canceled the focus should be restored to 122 // selection. If window selection is canceled the focus should be restored to
116 // this window. 123 // this window.
117 aura::Window* restore_focus_window_; 124 aura::Window* restore_focus_window_;
118 125
119 // True when performing operations that may cause window activations. This is 126 // True when performing operations that may cause window activations. This is
120 // used to prevent handling the resulting expected activation. 127 // used to prevent handling the resulting expected activation.
121 bool ignore_activations_; 128 bool ignore_activations_;
122 129
130 // List of all the window overview grids, one for each root window.
131 ScopedVector<WindowGrid> grid_list_;
132
123 // The time when overview was started. 133 // The time when overview was started.
124 base::Time overview_start_time_; 134 base::Time overview_start_time_;
125 135
126 // Tracks windows which were hidden because they were not part of the 136 // Tracks windows which were hidden because they were not part of the
127 // overview. 137 // overview.
128 aura::WindowTracker hidden_windows_; 138 aura::WindowTracker hidden_windows_;
129 139
140 // Tracks the index of the root window the selection widget is in.
141 size_t selected_grid_index_;
142
130 DISALLOW_COPY_AND_ASSIGN(WindowSelector); 143 DISALLOW_COPY_AND_ASSIGN(WindowSelector);
131 }; 144 };
132 145
133 } // namespace ash 146 } // namespace ash
134 147
135 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ 148 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698