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> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 aura::WindowObserver, | 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(aura::Window* root_window, |
54 const std::vector<WmWindow*>& window_list, | 54 const std::vector<aura::Window*>& 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 |
61 // 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 |
62 // minimized windows and ensure they are visible. | 62 // minimized windows and ensure they are visible. |
63 void PrepareForOverview(); | 63 void PrepareForOverview(); |
64 | 64 |
(...skipping 14 matching lines...) Expand all Loading... |
79 // Updates |selected_index_| according to the specified |direction| and calls | 79 // Updates |selected_index_| according to the specified |direction| and calls |
80 // MoveSelectionWidget(). Returns |true| if the new selection index is out of | 80 // MoveSelectionWidget(). Returns |true| if the new selection index is out of |
81 // this window grid bounds. | 81 // this window grid bounds. |
82 bool Move(WindowSelector::Direction direction, bool animate); | 82 bool Move(WindowSelector::Direction direction, bool animate); |
83 | 83 |
84 // 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. |
85 WindowSelectorItem* SelectedWindow() const; | 85 WindowSelectorItem* SelectedWindow() const; |
86 | 86 |
87 // 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 |
88 // this grid owns. | 88 // this grid owns. |
89 bool Contains(const WmWindow* window) const; | 89 bool Contains(const aura::Window* window) const; |
90 | 90 |
91 // 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 |
92 // selection. The pattern has its accents removed and is converted to | 92 // selection. The pattern has its accents removed and is converted to |
93 // lowercase in a l10n sensitive context. | 93 // lowercase in a l10n sensitive context. |
94 // If |pattern| is empty, no item is dimmed. | 94 // If |pattern| is empty, no item is dimmed. |
95 void FilterItems(const base::string16& pattern); | 95 void FilterItems(const base::string16& pattern); |
96 | 96 |
97 // 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 |
98 // selected the implementation fades out |selection_widget_| to transparent | 98 // selected the implementation fades out |selection_widget_| to transparent |
99 // opacity, effectively hiding the selector widget. | 99 // opacity, effectively hiding the selector widget. |
100 void WindowClosing(WindowSelectorItem* window); | 100 void WindowClosing(WindowSelectorItem* window); |
101 | 101 |
102 // Returns true if the grid has no more windows. | 102 // Returns true if the grid has no more windows. |
103 bool empty() const { return window_list_.empty(); } | 103 bool empty() const { return window_list_.empty(); } |
104 | 104 |
105 // Returns how many window selector items are in the grid. | 105 // Returns how many window selector items are in the grid. |
106 size_t size() const { return window_list_.size(); } | 106 size_t size() const { return window_list_.size(); } |
107 | 107 |
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 aura::Window* 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 // aura::WindowObserver: | 118 // aura::WindowObserver: |
119 void OnWindowDestroying(aura::Window* 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(aura::Window* window, | 121 void OnWindowBoundsChanged(aura::Window* window, |
122 const gfx::Rect& old_bounds, | 122 const gfx::Rect& old_bounds, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // |max_right| parameters are ignored and their values are always initialized | 154 // |max_right| parameters are ignored and their values are always initialized |
155 // inside this method. Returns true on success and false otherwise. | 155 // inside this method. Returns true on success and false otherwise. |
156 bool FitWindowRectsInBounds(const gfx::Rect& bounds, | 156 bool FitWindowRectsInBounds(const gfx::Rect& bounds, |
157 int height, | 157 int height, |
158 std::vector<gfx::Rect>* rects, | 158 std::vector<gfx::Rect>* rects, |
159 int* max_bottom, | 159 int* max_bottom, |
160 int* min_right, | 160 int* min_right, |
161 int* max_right); | 161 int* max_right); |
162 | 162 |
163 // Root window the grid is in. | 163 // Root window the grid is in. |
164 WmWindow* root_window_; | 164 aura::Window* 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<aura::Window, 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 |
(...skipping 14 matching lines...) Expand all Loading... |
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_WM_OVERVIEW_WINDOW_GRID_H_ | 198 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ |
OLD | NEW |