OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/shelf_layout_manager_observer.h" | 9 #include "ash/shelf/shelf_layout_manager_observer.h" |
10 #include "ash/shell_observer.h" | 10 #include "ash/shell_observer.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 public wm::WindowStateObserver { | 76 public wm::WindowStateObserver { |
77 public: | 77 public: |
78 // Maximum width of the docked windows area. | 78 // Maximum width of the docked windows area. |
79 static const int kMaxDockWidth; | 79 static const int kMaxDockWidth; |
80 | 80 |
81 // Minimum width of the docked windows area. | 81 // Minimum width of the docked windows area. |
82 static const int kMinDockWidth; | 82 static const int kMinDockWidth; |
83 | 83 |
84 DockedWindowLayoutManager(aura::Window* dock_container, | 84 DockedWindowLayoutManager(aura::Window* dock_container, |
85 WorkspaceController* workspace_controller); | 85 WorkspaceController* workspace_controller); |
86 virtual ~DockedWindowLayoutManager(); | 86 ~DockedWindowLayoutManager() override; |
87 | 87 |
88 // Disconnects observers before container windows get destroyed. | 88 // Disconnects observers before container windows get destroyed. |
89 void Shutdown(); | 89 void Shutdown(); |
90 | 90 |
91 // Management of the observer list. | 91 // Management of the observer list. |
92 virtual void AddObserver(DockedWindowLayoutManagerObserver* observer); | 92 virtual void AddObserver(DockedWindowLayoutManagerObserver* observer); |
93 virtual void RemoveObserver(DockedWindowLayoutManagerObserver* observer); | 93 virtual void RemoveObserver(DockedWindowLayoutManagerObserver* observer); |
94 | 94 |
95 // Called by a DockedWindowResizer to update which window is being dragged. | 95 // Called by a DockedWindowResizer to update which window is being dragged. |
96 // Starts observing the window unless it is a child. | 96 // Starts observing the window unless it is a child. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Returns last known coordinates of |dragged_window_| after Relayout. | 141 // Returns last known coordinates of |dragged_window_| after Relayout. |
142 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} | 142 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} |
143 | 143 |
144 // Returns true if currently dragged window is docked at the screen edge. | 144 // Returns true if currently dragged window is docked at the screen edge. |
145 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } | 145 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } |
146 | 146 |
147 // Updates docked layout when shelf bounds change. | 147 // Updates docked layout when shelf bounds change. |
148 void OnShelfBoundsChanged(); | 148 void OnShelfBoundsChanged(); |
149 | 149 |
150 // SnapLayoutManager: | 150 // SnapLayoutManager: |
151 virtual void OnWindowResized() override; | 151 void OnWindowResized() override; |
152 virtual void OnWindowAddedToLayout(aura::Window* child) override; | 152 void OnWindowAddedToLayout(aura::Window* child) override; |
153 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} | 153 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} |
154 virtual void OnWindowRemovedFromLayout(aura::Window* child) override; | 154 void OnWindowRemovedFromLayout(aura::Window* child) override; |
155 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 155 void OnChildWindowVisibilityChanged(aura::Window* child, |
156 bool visibile) override; | 156 bool visibile) override; |
157 virtual void SetChildBounds(aura::Window* child, | 157 void SetChildBounds(aura::Window* child, |
158 const gfx::Rect& requested_bounds) override; | 158 const gfx::Rect& requested_bounds) override; |
159 | 159 |
160 // ash::ShellObserver: | 160 // ash::ShellObserver: |
161 virtual void OnDisplayWorkAreaInsetsChanged() override; | 161 void OnDisplayWorkAreaInsetsChanged() override; |
162 virtual void OnFullscreenStateChanged(bool is_fullscreen, | 162 void OnFullscreenStateChanged(bool is_fullscreen, |
163 aura::Window* root_window) override; | 163 aura::Window* root_window) override; |
164 virtual void OnShelfAlignmentChanged(aura::Window* root_window) override; | 164 void OnShelfAlignmentChanged(aura::Window* root_window) override; |
165 | 165 |
166 // ShelfLayoutManagerObserver: | 166 // ShelfLayoutManagerObserver: |
167 virtual void OnBackgroundUpdated( | 167 void OnBackgroundUpdated(ShelfBackgroundType background_type, |
168 ShelfBackgroundType background_type, | 168 BackgroundAnimatorChangeType change_type) override; |
169 BackgroundAnimatorChangeType change_type) override; | |
170 | 169 |
171 // wm::WindowStateObserver: | 170 // wm::WindowStateObserver: |
172 virtual void OnPreWindowStateTypeChange( | 171 void OnPreWindowStateTypeChange(wm::WindowState* window_state, |
173 wm::WindowState* window_state, | 172 wm::WindowStateType old_type) override; |
174 wm::WindowStateType old_type) override; | |
175 | 173 |
176 // aura::WindowObserver: | 174 // aura::WindowObserver: |
177 virtual void OnWindowBoundsChanged(aura::Window* window, | 175 void OnWindowBoundsChanged(aura::Window* window, |
178 const gfx::Rect& old_bounds, | 176 const gfx::Rect& old_bounds, |
179 const gfx::Rect& new_bounds) override; | 177 const gfx::Rect& new_bounds) override; |
180 virtual void OnWindowVisibilityChanging(aura::Window* window, | 178 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; |
181 bool visible) override; | 179 void OnWindowDestroying(aura::Window* window) override; |
182 virtual void OnWindowDestroying(aura::Window* window) override; | |
183 | 180 |
184 // aura::client::ActivationChangeObserver: | 181 // aura::client::ActivationChangeObserver: |
185 virtual void OnWindowActivated(aura::Window* gained_active, | 182 void OnWindowActivated(aura::Window* gained_active, |
186 aura::Window* lost_active) override; | 183 aura::Window* lost_active) override; |
187 | 184 |
188 private: | 185 private: |
189 class ShelfWindowObserver; | 186 class ShelfWindowObserver; |
190 friend class DockedWindowLayoutManagerTest; | 187 friend class DockedWindowLayoutManagerTest; |
191 friend class DockedWindowResizerTest; | 188 friend class DockedWindowResizerTest; |
192 | 189 |
193 // Width of the gap between the docked windows and a workspace. | 190 // Width of the gap between the docked windows and a workspace. |
194 static const int kMinDockGap; | 191 static const int kMinDockGap; |
195 | 192 |
196 // Ideal (starting) width of the dock. | 193 // Ideal (starting) width of the dock. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Updates |docked_bounds_| and workspace insets when bounds of docked windows | 256 // Updates |docked_bounds_| and workspace insets when bounds of docked windows |
260 // area change. Passing |reason| to observers allows selectively skipping | 257 // area change. Passing |reason| to observers allows selectively skipping |
261 // notifications. | 258 // notifications. |
262 void UpdateDockBounds(DockedWindowLayoutManagerObserver::Reason reason); | 259 void UpdateDockBounds(DockedWindowLayoutManagerObserver::Reason reason); |
263 | 260 |
264 // Called whenever the window stacking order needs to be updated (e.g. focus | 261 // Called whenever the window stacking order needs to be updated (e.g. focus |
265 // changes or a window is moved). | 262 // changes or a window is moved). |
266 void UpdateStacking(aura::Window* active_window); | 263 void UpdateStacking(aura::Window* active_window); |
267 | 264 |
268 // keyboard::KeyboardControllerObserver: | 265 // keyboard::KeyboardControllerObserver: |
269 virtual void OnKeyboardBoundsChanging( | 266 void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; |
270 const gfx::Rect& keyboard_bounds) override; | |
271 | 267 |
272 // Parent window associated with this layout manager. | 268 // Parent window associated with this layout manager. |
273 aura::Window* dock_container_; | 269 aura::Window* dock_container_; |
274 // Protect against recursive calls to Relayout(). | 270 // Protect against recursive calls to Relayout(). |
275 bool in_layout_; | 271 bool in_layout_; |
276 | 272 |
277 // A window that is being dragged (whether docked or not). | 273 // A window that is being dragged (whether docked or not). |
278 // Windows are tracked by docked layout manager only if they are docked; | 274 // Windows are tracked by docked layout manager only if they are docked; |
279 // however we need to know if a window is being dragged in order to avoid | 275 // however we need to know if a window is being dragged in order to avoid |
280 // positioning it or even considering it for layout. | 276 // positioning it or even considering it for layout. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 325 |
330 // Observers of dock bounds changes. | 326 // Observers of dock bounds changes. |
331 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 327 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
332 | 328 |
333 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 329 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
334 }; | 330 }; |
335 | 331 |
336 } // namespace ash | 332 } // namespace ash |
337 | 333 |
338 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 334 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |