| 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_WM_OVERVIEW_WINDOW_GRID_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
| 6 #define ASH_WM_OVERVIEW_WINDOW_GRID_H_ | 6 #define ASH_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/wm/overview/window_selector.h" | 14 #include "ash/wm/overview/window_selector.h" |
| 15 #include "ash/wm/window_state_observer.h" | 15 #include "ash/wm/window_state_observer.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 19 #include "ui/gfx/geometry/rect.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 { |
| 25 class Shadow; | 26 class Shadow; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace ash { | 29 namespace ash { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 // The selector is switched to the next window grid (if available) or wrapped if | 49 // The selector is switched to the next window grid (if available) or wrapped if |
| 49 // it reaches the end of its movement sequence. | 50 // it reaches the end of its movement sequence. |
| 50 class ASH_EXPORT WindowGrid : public aura::WindowObserver, | 51 class ASH_EXPORT WindowGrid : public aura::WindowObserver, |
| 51 public wm::WindowStateObserver { | 52 public wm::WindowStateObserver { |
| 52 public: | 53 public: |
| 53 WindowGrid(aura::Window* root_window, | 54 WindowGrid(aura::Window* root_window, |
| 54 const std::vector<aura::Window*>& window_list, | 55 const std::vector<aura::Window*>& window_list, |
| 55 WindowSelector* window_selector); | 56 WindowSelector* window_selector, |
| 57 const gfx::Rect& bounds_in_screen); |
| 56 ~WindowGrid() override; | 58 ~WindowGrid() override; |
| 57 | 59 |
| 58 // Exits overview mode, fading out the |shield_widget_| if necessary. | 60 // Exits overview mode, fading out the |shield_widget_| if necessary. |
| 59 void Shutdown(); | 61 void Shutdown(); |
| 60 | 62 |
| 61 // Prepares the windows in this grid for overview. This will restore all | 63 // Prepares the windows in this grid for overview. This will restore all |
| 62 // minimized windows and ensure they are visible. | 64 // minimized windows and ensure they are visible. |
| 63 void PrepareForOverview(); | 65 void PrepareForOverview(); |
| 64 | 66 |
| 65 // Positions all the windows in rows of equal height scaling each window to | 67 // Positions all the windows in rows of equal height scaling each window to |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 // this window grid bounds. | 83 // this window grid bounds. |
| 82 bool Move(WindowSelector::Direction direction, bool animate); | 84 bool Move(WindowSelector::Direction direction, bool animate); |
| 83 | 85 |
| 84 // Returns the target selected window, or NULL if there is none selected. | 86 // Returns the target selected window, or NULL if there is none selected. |
| 85 WindowSelectorItem* SelectedWindow() const; | 87 WindowSelectorItem* SelectedWindow() const; |
| 86 | 88 |
| 87 // Returns true if a window is contained in any of the WindowSelectorItems | 89 // Returns true if a window is contained in any of the WindowSelectorItems |
| 88 // this grid owns. | 90 // this grid owns. |
| 89 bool Contains(const aura::Window* window) const; | 91 bool Contains(const aura::Window* window) const; |
| 90 | 92 |
| 93 // Removes |selector_item| from the grid. |
| 94 void RemoveItem(WindowSelectorItem* selector_item); |
| 95 |
| 91 // Dims the items whose titles do not contain |pattern| and prevents their | 96 // Dims the items whose titles do not contain |pattern| and prevents their |
| 92 // selection. The pattern has its accents removed and is converted to | 97 // selection. The pattern has its accents removed and is converted to |
| 93 // lowercase in a l10n sensitive context. | 98 // lowercase in a l10n sensitive context. |
| 94 // If |pattern| is empty, no item is dimmed. | 99 // If |pattern| is empty, no item is dimmed. |
| 95 void FilterItems(const base::string16& pattern); | 100 void FilterItems(const base::string16& pattern); |
| 96 | 101 |
| 97 // Called when |window| is about to get closed. If the |window| is currently | 102 // Called when |window| is about to get closed. If the |window| is currently |
| 98 // selected the implementation fades out |selection_widget_| to transparent | 103 // selected the implementation fades out |selection_widget_| to transparent |
| 99 // opacity, effectively hiding the selector widget. | 104 // opacity, effectively hiding the selector widget. |
| 100 void WindowClosing(WindowSelectorItem* window); | 105 void WindowClosing(WindowSelectorItem* window); |
| 101 | 106 |
| 107 // Sets bounds for the window grid and positions all windows in the grid. |
| 108 void SetBoundsAndUpdatePositions(const gfx::Rect& bounds_in_screen); |
| 109 |
| 102 // Returns true if the grid has no more windows. | 110 // Returns true if the grid has no more windows. |
| 103 bool empty() const { return window_list_.empty(); } | 111 bool empty() const { return window_list_.empty(); } |
| 104 | 112 |
| 105 // Returns how many window selector items are in the grid. | 113 // Returns how many window selector items are in the grid. |
| 106 size_t size() const { return window_list_.size(); } | 114 size_t size() const { return window_list_.size(); } |
| 107 | 115 |
| 108 // Returns true if the selection widget is active. | 116 // Returns true if the selection widget is active. |
| 109 bool is_selecting() const { return selection_widget_ != nullptr; } | 117 bool is_selecting() const { return selection_widget_ != nullptr; } |
| 110 | 118 |
| 111 // Returns the root window in which the grid displays the windows. | 119 // Returns the root window in which the grid displays the windows. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 191 |
| 184 // Current selected window position. | 192 // Current selected window position. |
| 185 size_t selected_index_; | 193 size_t selected_index_; |
| 186 | 194 |
| 187 // Number of columns in the grid. | 195 // Number of columns in the grid. |
| 188 size_t num_columns_; | 196 size_t num_columns_; |
| 189 | 197 |
| 190 // True only after all windows have been prepared for overview. | 198 // True only after all windows have been prepared for overview. |
| 191 bool prepared_for_overview_; | 199 bool prepared_for_overview_; |
| 192 | 200 |
| 201 // This WindowGrid's total bounds in screen coordinates. |
| 202 gfx::Rect bounds_; |
| 203 |
| 193 DISALLOW_COPY_AND_ASSIGN(WindowGrid); | 204 DISALLOW_COPY_AND_ASSIGN(WindowGrid); |
| 194 }; | 205 }; |
| 195 | 206 |
| 196 } // namespace ash | 207 } // namespace ash |
| 197 | 208 |
| 198 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ | 209 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
| OLD | NEW |