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

Side by Side Diff: ash/common/wm/overview/window_grid.h

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 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
« no previous file with comments | « ash/common/wm/mru_window_tracker.cc ('k') | ash/common/wm/overview/window_grid.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ 5 #ifndef ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_
6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ 6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "ash/common/wm/overview/window_selector.h" 14 #include "ash/common/wm/overview/window_selector.h"
15 #include "ash/common/wm/window_state_observer.h" 15 #include "ash/common/wm/window_state_observer.h"
16 #include "ash/common/wm_window_observer.h"
17 #include "base/macros.h" 16 #include "base/macros.h"
18 #include "base/scoped_observer.h" 17 #include "base/scoped_observer.h"
18 #include "ui/aura/window_observer.h"
19 19
20 namespace views { 20 namespace views {
21 class Widget; 21 class Widget;
22 } 22 }
23 23
24 namespace wm { 24 namespace wm {
25 class Shadow; 25 class Shadow;
26 } 26 }
27 27
28 namespace ash { 28 namespace ash {
(...skipping 11 matching lines...) Expand all
40 // | 3 | | 4 | | 5 | 40 // | 3 | | 4 | | 5 |
41 // +-------+ +-------+ +-------+ 41 // +-------+ +-------+ +-------+
42 // +-------+ 42 // +-------+
43 // | 6 | 43 // | 6 |
44 // +-------+ 44 // +-------+
45 // Example sequences: 45 // Example sequences:
46 // - Going right to left 46 // - Going right to left
47 // 0, 1, 2, 3, 4, 5, 6 47 // 0, 1, 2, 3, 4, 5, 6
48 // The selector is switched to the next window grid (if available) or wrapped if 48 // The selector is switched to the next window grid (if available) or wrapped if
49 // it reaches the end of its movement sequence. 49 // it reaches the end of its movement sequence.
50 class ASH_EXPORT WindowGrid : public WmWindowObserver, 50 class ASH_EXPORT WindowGrid : public aura::WindowObserver,
51 public wm::WindowStateObserver { 51 public wm::WindowStateObserver {
52 public: 52 public:
53 WindowGrid(WmWindow* root_window, 53 WindowGrid(WmWindow* root_window,
54 const std::vector<WmWindow*>& window_list, 54 const std::vector<WmWindow*>& window_list,
55 WindowSelector* window_selector); 55 WindowSelector* window_selector);
56 ~WindowGrid() override; 56 ~WindowGrid() override;
57 57
58 // Exits overview mode, fading out the |shield_widget_| if necessary. 58 // Exits overview mode, fading out the |shield_widget_| if necessary.
59 void Shutdown(); 59 void Shutdown();
60 60
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Returns true if the selection widget is active. 108 // Returns true if the selection widget is active.
109 bool is_selecting() const { return selection_widget_ != nullptr; } 109 bool is_selecting() const { return selection_widget_ != nullptr; }
110 110
111 // Returns the root window in which the grid displays the windows. 111 // Returns the root window in which the grid displays the windows.
112 const WmWindow* root_window() const { return root_window_; } 112 const WmWindow* root_window() const { return root_window_; }
113 113
114 const std::vector<std::unique_ptr<WindowSelectorItem>>& window_list() const { 114 const std::vector<std::unique_ptr<WindowSelectorItem>>& window_list() const {
115 return window_list_; 115 return window_list_;
116 } 116 }
117 117
118 // WmWindowObserver: 118 // aura::WindowObserver:
119 void OnWindowDestroying(WmWindow* window) override; 119 void OnWindowDestroying(aura::Window* window) override;
120 // TODO(flackr): Handle window bounds changed in WindowSelectorItem. 120 // TODO(flackr): Handle window bounds changed in WindowSelectorItem.
121 void OnWindowBoundsChanged(WmWindow* window, 121 void OnWindowBoundsChanged(aura::Window* window,
122 const gfx::Rect& old_bounds, 122 const gfx::Rect& old_bounds,
123 const gfx::Rect& new_bounds) override; 123 const gfx::Rect& new_bounds) override;
124 124
125 // wm::WindowStateObserver: 125 // wm::WindowStateObserver:
126 void OnPostWindowStateTypeChange(wm::WindowState* window_state, 126 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
127 wm::WindowStateType old_type) override; 127 wm::WindowStateType old_type) override;
128 128
129 private: 129 private:
130 friend class WindowSelectorTest; 130 friend class WindowSelectorTest;
131 131
(...skipping 30 matching lines...) Expand all
162 162
163 // Root window the grid is in. 163 // Root window the grid is in.
164 WmWindow* root_window_; 164 WmWindow* root_window_;
165 165
166 // Pointer to the window selector that spawned this grid. 166 // Pointer to the window selector that spawned this grid.
167 WindowSelector* window_selector_; 167 WindowSelector* window_selector_;
168 168
169 // Vector containing all the windows in this grid. 169 // Vector containing all the windows in this grid.
170 std::vector<std::unique_ptr<WindowSelectorItem>> window_list_; 170 std::vector<std::unique_ptr<WindowSelectorItem>> window_list_;
171 171
172 ScopedObserver<WmWindow, WindowGrid> window_observer_; 172 ScopedObserver<aura::Window, WindowGrid> window_observer_;
173 ScopedObserver<wm::WindowState, WindowGrid> window_state_observer_; 173 ScopedObserver<wm::WindowState, WindowGrid> window_state_observer_;
174 174
175 // Widget that darkens the screen background. 175 // Widget that darkens the screen background.
176 std::unique_ptr<views::Widget> shield_widget_; 176 std::unique_ptr<views::Widget> shield_widget_;
177 177
178 // Widget that indicates to the user which is the selected window. 178 // Widget that indicates to the user which is the selected window.
179 std::unique_ptr<views::Widget> selection_widget_; 179 std::unique_ptr<views::Widget> selection_widget_;
180 180
181 // Shadow around the selector. 181 // Shadow around the selector.
182 std::unique_ptr<::wm::Shadow> selector_shadow_; 182 std::unique_ptr<::wm::Shadow> selector_shadow_;
183 183
184 // Current selected window position. 184 // Current selected window position.
185 size_t selected_index_; 185 size_t selected_index_;
186 186
187 // Number of columns in the grid. 187 // Number of columns in the grid.
188 size_t num_columns_; 188 size_t num_columns_;
189 189
190 // True only after all windows have been prepared for overview. 190 // True only after all windows have been prepared for overview.
191 bool prepared_for_overview_; 191 bool prepared_for_overview_;
192 192
193 DISALLOW_COPY_AND_ASSIGN(WindowGrid); 193 DISALLOW_COPY_AND_ASSIGN(WindowGrid);
194 }; 194 };
195 195
196 } // namespace ash 196 } // namespace ash
197 197
198 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ 198 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_
OLDNEW
« no previous file with comments | « ash/common/wm/mru_window_tracker.cc ('k') | ash/common/wm/overview/window_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698