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