OLD | NEW |
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> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Layout is done in 2 stages maintaining fixed MRU ordering. | 68 // Layout is done in 2 stages maintaining fixed MRU ordering. |
69 // 1. Optimal height is determined. In this stage |height| is bisected to find | 69 // 1. Optimal height is determined. In this stage |height| is bisected to find |
70 // maximum height which still allows all the windows to fit. | 70 // maximum height which still allows all the windows to fit. |
71 // 2. Row widths are balanced. In this stage the available width is reduced | 71 // 2. Row widths are balanced. In this stage the available width is reduced |
72 // until some windows are no longer fitting or until the difference between | 72 // until some windows are no longer fitting or until the difference between |
73 // the narrowest and the widest rows starts growing. | 73 // the narrowest and the widest rows starts growing. |
74 // Overall this achieves the goals of maximum size for previews (or maximum | 74 // Overall this achieves the goals of maximum size for previews (or maximum |
75 // row height which is equivalent assuming fixed height), balanced rows and | 75 // row height which is equivalent assuming fixed height), balanced rows and |
76 // minimal wasted space. | 76 // minimal wasted space. |
77 // Optionally animates the windows to their targets when |animate| is true. | 77 // Optionally animates the windows to their targets when |animate| is true. |
78 void PositionWindowsMD(bool animate); | |
79 | |
80 // Positions all the windows in the grid. | |
81 // Optionally animates the windows to their targets when |animate| is true. | |
82 void PositionWindows(bool animate); | 78 void PositionWindows(bool animate); |
83 | 79 |
84 // Updates |selected_index_| according to the specified |direction| and calls | 80 // Updates |selected_index_| according to the specified |direction| and calls |
85 // MoveSelectionWidget(). Returns |true| if the new selection index is out of | 81 // MoveSelectionWidget(). Returns |true| if the new selection index is out of |
86 // this window grid bounds. | 82 // this window grid bounds. |
87 bool Move(WindowSelector::Direction direction, bool animate); | 83 bool Move(WindowSelector::Direction direction, bool animate); |
88 | 84 |
89 // Returns the target selected window, or NULL if there is none selected. | 85 // Returns the target selected window, or NULL if there is none selected. |
90 WindowSelectorItem* SelectedWindow() const; | 86 WindowSelectorItem* SelectedWindow() const; |
91 | 87 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // widest rows respectively. In-values of the |max_bottom|, |min_right| and | 150 // widest rows respectively. In-values of the |max_bottom|, |min_right| and |
155 // |max_right| parameters are ignored and their values are always initialized | 151 // |max_right| parameters are ignored and their values are always initialized |
156 // inside this method. Returns true on success and false otherwise. | 152 // inside this method. Returns true on success and false otherwise. |
157 bool FitWindowRectsInBounds(const gfx::Rect& bounds, | 153 bool FitWindowRectsInBounds(const gfx::Rect& bounds, |
158 int height, | 154 int height, |
159 std::vector<gfx::Rect>* rects, | 155 std::vector<gfx::Rect>* rects, |
160 int* max_bottom, | 156 int* max_bottom, |
161 int* min_right, | 157 int* min_right, |
162 int* max_right); | 158 int* max_right); |
163 | 159 |
164 // Sets up WindowSelectorItem to use masks or shapes based on command flags. | |
165 // TODO(varkha): remove this in the next patch and use shapes but not masks. | |
166 void PrepareForUsingMasksOrShapes(size_t windows_count) const; | |
167 | |
168 // Root window the grid is in. | 160 // Root window the grid is in. |
169 WmWindow* root_window_; | 161 WmWindow* root_window_; |
170 | 162 |
171 // Pointer to the window selector that spawned this grid. | 163 // Pointer to the window selector that spawned this grid. |
172 WindowSelector* window_selector_; | 164 WindowSelector* window_selector_; |
173 | 165 |
174 // Vector containing all the windows in this grid. | 166 // Vector containing all the windows in this grid. |
175 ScopedVector<WindowSelectorItem> window_list_; | 167 ScopedVector<WindowSelectorItem> window_list_; |
176 | 168 |
177 ScopedObserver<WmWindow, WindowGrid> window_observer_; | 169 ScopedObserver<WmWindow, WindowGrid> window_observer_; |
(...skipping 15 matching lines...) Expand all Loading... |
193 | 185 |
194 // True only after all windows have been prepared for overview. | 186 // True only after all windows have been prepared for overview. |
195 bool prepared_for_overview_; | 187 bool prepared_for_overview_; |
196 | 188 |
197 DISALLOW_COPY_AND_ASSIGN(WindowGrid); | 189 DISALLOW_COPY_AND_ASSIGN(WindowGrid); |
198 }; | 190 }; |
199 | 191 |
200 } // namespace ash | 192 } // namespace ash |
201 | 193 |
202 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ | 194 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ |
OLD | NEW |