OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 enum Direction { | 59 enum Direction { |
60 LEFT, | 60 LEFT, |
61 UP, | 61 UP, |
62 RIGHT, | 62 RIGHT, |
63 DOWN | 63 DOWN |
64 }; | 64 }; |
65 | 65 |
66 typedef std::vector<aura::Window*> WindowList; | 66 typedef std::vector<aura::Window*> WindowList; |
67 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; | 67 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; |
68 | 68 |
69 WindowSelector(const WindowList& windows, | 69 explicit WindowSelector(WindowSelectorDelegate* delegate); |
70 WindowSelectorDelegate* delegate); | |
71 ~WindowSelector() override; | 70 ~WindowSelector() override; |
72 | 71 |
| 72 // Initialize with the windows that can be selected. |
| 73 void Init(const WindowList& windows); |
| 74 |
| 75 // Perform cleanup that cannot be done in the destructor. |
| 76 void Shutdown(); |
| 77 |
73 // Cancels window selection. | 78 // Cancels window selection. |
74 void CancelSelection(); | 79 void CancelSelection(); |
75 | 80 |
76 // Called when the last window selector item from a grid is deleted. | 81 // Called when the last window selector item from a grid is deleted. |
77 void OnGridEmpty(WindowGrid* grid); | 82 void OnGridEmpty(WindowGrid* grid); |
78 | 83 |
| 84 bool restoring_minimized_windows() const { |
| 85 return restoring_minimized_windows_; |
| 86 } |
| 87 |
79 // gfx::DisplayObserver: | 88 // gfx::DisplayObserver: |
80 void OnDisplayAdded(const gfx::Display& display) override; | 89 void OnDisplayAdded(const gfx::Display& display) override; |
81 void OnDisplayRemoved(const gfx::Display& display) override; | 90 void OnDisplayRemoved(const gfx::Display& display) override; |
82 void OnDisplayMetricsChanged(const gfx::Display& display, | 91 void OnDisplayMetricsChanged(const gfx::Display& display, |
83 uint32_t metrics) override; | 92 uint32_t metrics) override; |
84 | 93 |
85 // aura::WindowObserver: | 94 // aura::WindowObserver: |
86 void OnWindowAdded(aura::Window* new_window) override; | 95 void OnWindowAdded(aura::Window* new_window) override; |
87 void OnWindowDestroying(aura::Window* window) override; | 96 void OnWindowDestroying(aura::Window* window) override; |
88 | 97 |
(...skipping 21 matching lines...) Expand all Loading... |
110 // Hide and track all hidden windows not in the overview item list. | 119 // Hide and track all hidden windows not in the overview item list. |
111 void HideAndTrackNonOverviewWindows(); | 120 void HideAndTrackNonOverviewWindows(); |
112 | 121 |
113 // |focus|, restores focus to the stored window. | 122 // |focus|, restores focus to the stored window. |
114 void ResetFocusRestoreWindow(bool focus); | 123 void ResetFocusRestoreWindow(bool focus); |
115 | 124 |
116 // Helper function that moves the selection widget to |direction| on the | 125 // Helper function that moves the selection widget to |direction| on the |
117 // corresponding window grid. | 126 // corresponding window grid. |
118 void Move(Direction direction, bool animate); | 127 void Move(Direction direction, bool animate); |
119 | 128 |
| 129 // Removes all observers that were registered during construction and/or |
| 130 // initialization. |
| 131 void RemoveAllObservers(); |
| 132 |
120 // Tracks observed windows. | 133 // Tracks observed windows. |
121 std::set<aura::Window*> observed_windows_; | 134 std::set<aura::Window*> observed_windows_; |
122 | 135 |
123 // Weak pointer to the selector delegate which will be called when a | 136 // Weak pointer to the selector delegate which will be called when a |
124 // selection is made. | 137 // selection is made. |
125 WindowSelectorDelegate* delegate_; | 138 WindowSelectorDelegate* delegate_; |
126 | 139 |
127 // A weak pointer to the window which was focused on beginning window | 140 // A weak pointer to the window which was focused on beginning window |
128 // selection. If window selection is canceled the focus should be restored to | 141 // selection. If window selection is canceled the focus should be restored to |
129 // this window. | 142 // this window. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // such as enter key to select. | 175 // such as enter key to select. |
163 scoped_ptr<views::Widget> text_filter_widget_; | 176 scoped_ptr<views::Widget> text_filter_widget_; |
164 | 177 |
165 // The current length of the string entered into the text filtering textfield. | 178 // The current length of the string entered into the text filtering textfield. |
166 size_t text_filter_string_length_; | 179 size_t text_filter_string_length_; |
167 | 180 |
168 // The number of times the text filtering textfield has been cleared of text | 181 // The number of times the text filtering textfield has been cleared of text |
169 // during this overview mode session. | 182 // during this overview mode session. |
170 size_t num_times_textfield_cleared_; | 183 size_t num_times_textfield_cleared_; |
171 | 184 |
| 185 // Tracks whether minimized windows are currently being restored for overview |
| 186 // mode. |
| 187 bool restoring_minimized_windows_; |
| 188 |
172 DISALLOW_COPY_AND_ASSIGN(WindowSelector); | 189 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
173 }; | 190 }; |
174 | 191 |
175 } // namespace ash | 192 } // namespace ash |
176 | 193 |
177 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ | 194 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ |
OLD | NEW |