Chromium Code Reviews| 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> |
| 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_observer.h" | 16 #include "ash/common/wm_window_observer.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 18 #include "base/scoped_observer.h" | 19 #include "base/scoped_observer.h" |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 class Widget; | 22 class Widget; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace wm { | 25 namespace wm { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 39 // +-------+ +-------+ +-------+ | 40 // +-------+ +-------+ +-------+ |
| 40 // | 3 | | 4 | | 5 | | 41 // | 3 | | 4 | | 5 | |
| 41 // +-------+ +-------+ +-------+ | 42 // +-------+ +-------+ +-------+ |
| 42 // +-------+ | 43 // +-------+ |
| 43 // | 6 | | 44 // | 6 | |
| 44 // +-------+ | 45 // +-------+ |
| 45 // Example sequences: | 46 // Example sequences: |
| 46 // - Going right to left | 47 // - Going right to left |
| 47 // 0, 1, 2, 3, 4, 5, 6 | 48 // 0, 1, 2, 3, 4, 5, 6 |
| 48 // - Going "top" to "bottom" | 49 // - Going "top" to "bottom" |
| 49 // 0, 3, 6, 1, 4, 2, 5 | 50 // 0, 3, 6, 1, 4, 2, 5 |
|
varkha
2016/11/08 00:02:56
Can you also please delete the 2 lines above this
oshima
2016/11/10 23:58:47
Done.
| |
| 50 // The selector is switched to the next window grid (if available) or wrapped if | 51 // The selector is switched to the next window grid (if available) or wrapped if |
| 51 // it reaches the end of its movement sequence. | 52 // it reaches the end of its movement sequence. |
| 52 class ASH_EXPORT WindowGrid : public WmWindowObserver { | 53 class ASH_EXPORT WindowGrid : public WmWindowObserver, |
| 54 public wm::WindowStateObserver { | |
| 53 public: | 55 public: |
| 54 WindowGrid(WmWindow* root_window, | 56 WindowGrid(WmWindow* root_window, |
| 55 const std::vector<WmWindow*>& window_list, | 57 const std::vector<WmWindow*>& window_list, |
| 56 WindowSelector* window_selector); | 58 WindowSelector* window_selector); |
| 57 ~WindowGrid() override; | 59 ~WindowGrid() override; |
| 58 | 60 |
| 59 // Exits overview mode, fading out the |shield_widget_| if necessary. | 61 // Exits overview mode, fading out the |shield_widget_| if necessary. |
| 60 void Shutdown(); | 62 void Shutdown(); |
| 61 | 63 |
| 62 // Prepares the windows in this grid for overview. This will restore all | 64 // Prepares the windows in this grid for overview. This will restore all |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 return window_list_.get(); | 118 return window_list_.get(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 // WmWindowObserver: | 121 // WmWindowObserver: |
| 120 void OnWindowDestroying(WmWindow* window) override; | 122 void OnWindowDestroying(WmWindow* window) override; |
| 121 // TODO(flackr): Handle window bounds changed in WindowSelectorItem. | 123 // TODO(flackr): Handle window bounds changed in WindowSelectorItem. |
| 122 void OnWindowBoundsChanged(WmWindow* window, | 124 void OnWindowBoundsChanged(WmWindow* window, |
| 123 const gfx::Rect& old_bounds, | 125 const gfx::Rect& old_bounds, |
| 124 const gfx::Rect& new_bounds) override; | 126 const gfx::Rect& new_bounds) override; |
| 125 | 127 |
| 128 // wm::WindowStateObserver: | |
| 129 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | |
| 130 wm::WindowStateType old_type) override; | |
| 131 | |
| 126 private: | 132 private: |
| 127 friend class WindowSelectorTest; | 133 friend class WindowSelectorTest; |
| 128 | 134 |
| 129 // Initializes the screen shield widget. | 135 // Initializes the screen shield widget. |
| 130 void InitShieldWidget(); | 136 void InitShieldWidget(); |
| 131 | 137 |
| 132 // Internal function to initialize the selection widget. | 138 // Internal function to initialize the selection widget. |
| 133 void InitSelectionWidget(WindowSelector::Direction direction); | 139 void InitSelectionWidget(WindowSelector::Direction direction); |
| 134 | 140 |
| 135 // Moves the selection widget to the specified |direction|. | 141 // Moves the selection widget to the specified |direction|. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 160 // Root window the grid is in. | 166 // Root window the grid is in. |
| 161 WmWindow* root_window_; | 167 WmWindow* root_window_; |
| 162 | 168 |
| 163 // Pointer to the window selector that spawned this grid. | 169 // Pointer to the window selector that spawned this grid. |
| 164 WindowSelector* window_selector_; | 170 WindowSelector* window_selector_; |
| 165 | 171 |
| 166 // Vector containing all the windows in this grid. | 172 // Vector containing all the windows in this grid. |
| 167 ScopedVector<WindowSelectorItem> window_list_; | 173 ScopedVector<WindowSelectorItem> window_list_; |
| 168 | 174 |
| 169 ScopedObserver<WmWindow, WindowGrid> window_observer_; | 175 ScopedObserver<WmWindow, WindowGrid> window_observer_; |
| 176 ScopedObserver<wm::WindowState, WindowGrid> window_state_observer_; | |
| 170 | 177 |
| 171 // Widget that darkens the screen background. | 178 // Widget that darkens the screen background. |
| 172 std::unique_ptr<views::Widget> shield_widget_; | 179 std::unique_ptr<views::Widget> shield_widget_; |
| 173 | 180 |
| 174 // Widget that indicates to the user which is the selected window. | 181 // Widget that indicates to the user which is the selected window. |
| 175 std::unique_ptr<views::Widget> selection_widget_; | 182 std::unique_ptr<views::Widget> selection_widget_; |
| 176 | 183 |
| 177 // Shadow around the selector. | 184 // Shadow around the selector. |
| 178 std::unique_ptr<::wm::Shadow> selector_shadow_; | 185 std::unique_ptr<::wm::Shadow> selector_shadow_; |
| 179 | 186 |
| 180 // Current selected window position. | 187 // Current selected window position. |
| 181 size_t selected_index_; | 188 size_t selected_index_; |
| 182 | 189 |
| 183 // Number of columns in the grid. | 190 // Number of columns in the grid. |
| 184 size_t num_columns_; | 191 size_t num_columns_; |
| 185 | 192 |
| 186 // True only after all windows have been prepared for overview. | 193 // True only after all windows have been prepared for overview. |
| 187 bool prepared_for_overview_; | 194 bool prepared_for_overview_; |
| 188 | 195 |
| 189 DISALLOW_COPY_AND_ASSIGN(WindowGrid); | 196 DISALLOW_COPY_AND_ASSIGN(WindowGrid); |
| 190 }; | 197 }; |
| 191 | 198 |
| 192 } // namespace ash | 199 } // namespace ash |
| 193 | 200 |
| 194 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ | 201 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_GRID_H_ |
| OLD | NEW |