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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace gfx { | 32 namespace gfx { |
33 class Point; | 33 class Point; |
34 } | 34 } |
35 | 35 |
36 namespace views { | 36 namespace views { |
37 class Widget; | 37 class Widget; |
38 } | 38 } |
39 | 39 |
40 namespace ash { | 40 namespace ash { |
41 class Launcher; | 41 class Shelf; |
42 | 42 |
43 namespace internal { | 43 namespace internal { |
44 class DockedBackgroundWidget; | 44 class DockedBackgroundWidget; |
45 class DockedWindowLayoutManagerObserver; | 45 class DockedWindowLayoutManagerObserver; |
46 class DockedWindowResizerTest; | 46 class DockedWindowResizerTest; |
47 class ShelfLayoutManager; | 47 class ShelfLayoutManager; |
48 class WorkspaceController; | 48 class WorkspaceController; |
49 | 49 |
50 struct WindowWithHeight { | 50 struct WindowWithHeight { |
51 explicit WindowWithHeight(aura::Window* window) : | 51 explicit WindowWithHeight(aura::Window* window) : |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void DockDraggedWindow(aura::Window* window); | 103 void DockDraggedWindow(aura::Window* window); |
104 | 104 |
105 // Called by a DockedWindowResizer when a dragged window is no longer docked. | 105 // Called by a DockedWindowResizer when a dragged window is no longer docked. |
106 void UndockDraggedWindow(); | 106 void UndockDraggedWindow(); |
107 | 107 |
108 // Called by a DockedWindowResizer when a window is no longer being dragged. | 108 // Called by a DockedWindowResizer when a window is no longer being dragged. |
109 // Stops observing the window unless it is a child. | 109 // Stops observing the window unless it is a child. |
110 // Records |action| by |source| in UMA. | 110 // Records |action| by |source| in UMA. |
111 void FinishDragging(DockedAction action, DockedActionSource source); | 111 void FinishDragging(DockedAction action, DockedActionSource source); |
112 | 112 |
113 ash::Launcher* launcher() { return launcher_; } | 113 Shelf* shelf() { return shelf_; } |
114 void SetLauncher(ash::Launcher* launcher); | 114 void SetShelf(Shelf* shelf); |
115 | 115 |
116 // Calculates if a window is touching the screen edges and returns edge. | 116 // Calculates if a window is touching the screen edges and returns edge. |
117 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; | 117 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; |
118 | 118 |
119 // Used to snap docked windows to the side of screen during drag. | 119 // Used to snap docked windows to the side of screen during drag. |
120 DockedAlignment CalculateAlignment() const; | 120 DockedAlignment CalculateAlignment() const; |
121 | 121 |
122 // Returns true when a window can be docked. Windows cannot be docked at the | 122 // Returns true when a window can be docked. Windows cannot be docked at the |
123 // edge used by the launcher shelf or the edge opposite from existing dock. | 123 // edge used by the shelf or the edge opposite from existing dock. |
124 bool CanDockWindow(aura::Window* window, SnapType edge); | 124 bool CanDockWindow(aura::Window* window, SnapType edge); |
125 | 125 |
126 aura::Window* dock_container() const { return dock_container_; } | 126 aura::Window* dock_container() const { return dock_container_; } |
127 | 127 |
128 // Returns current bounding rectangle of docked windows area. | 128 // Returns current bounding rectangle of docked windows area. |
129 const gfx::Rect& docked_bounds() const { return docked_bounds_; } | 129 const gfx::Rect& docked_bounds() const { return docked_bounds_; } |
130 | 130 |
131 // Returns last known coordinates of |dragged_window_| after Relayout. | 131 // Returns last known coordinates of |dragged_window_| after Relayout. |
132 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} | 132 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} |
133 | 133 |
134 // Returns true if currently dragged window is docked at the screen edge. | 134 // Returns true if currently dragged window is docked at the screen edge. |
135 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } | 135 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } |
136 | 136 |
137 // Updates docked layout when launcher shelf bounds change. | 137 // Updates docked layout when shelf bounds change. |
138 void OnShelfBoundsChanged(); | 138 void OnShelfBoundsChanged(); |
139 | 139 |
140 // aura::LayoutManager: | 140 // aura::LayoutManager: |
141 virtual void OnWindowResized() OVERRIDE; | 141 virtual void OnWindowResized() OVERRIDE; |
142 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 142 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
143 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | 143 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
144 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 144 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
145 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 145 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
146 bool visibile) OVERRIDE; | 146 bool visibile) OVERRIDE; |
147 virtual void SetChildBounds(aura::Window* child, | 147 virtual void SetChildBounds(aura::Window* child, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 aura::Window* dragged_window_; | 257 aura::Window* dragged_window_; |
258 | 258 |
259 // True if the window being dragged is currently docked. | 259 // True if the window being dragged is currently docked. |
260 bool is_dragged_window_docked_; | 260 bool is_dragged_window_docked_; |
261 | 261 |
262 // Previously docked windows use a more relaxed dragging sorting algorithm | 262 // Previously docked windows use a more relaxed dragging sorting algorithm |
263 // that uses assumption that a window starts being dragged out of position | 263 // that uses assumption that a window starts being dragged out of position |
264 // that was previously established in Relayout. This allows easier reordering. | 264 // that was previously established in Relayout. This allows easier reordering. |
265 bool is_dragged_from_dock_; | 265 bool is_dragged_from_dock_; |
266 | 266 |
267 // The launcher to respond to launcher alignment changes. | 267 // The shelf to respond to alignment changes. |
268 Launcher* launcher_; | 268 Shelf* shelf_; |
269 | 269 |
270 // Workspace controller that can be checked for fullscreen mode. | 270 // Workspace controller that can be checked for fullscreen mode. |
271 WorkspaceController* workspace_controller_; | 271 WorkspaceController* workspace_controller_; |
272 // Tracks if any window in the same root window is in fullscreen mode. | 272 // Tracks if any window in the same root window is in fullscreen mode. |
273 bool in_fullscreen_; | 273 bool in_fullscreen_; |
274 // Current width of the dock. | 274 // Current width of the dock. |
275 int docked_width_; | 275 int docked_width_; |
276 | 276 |
277 // Last bounds that were sent to observers. | 277 // Last bounds that were sent to observers. |
278 gfx::Rect docked_bounds_; | 278 gfx::Rect docked_bounds_; |
279 | 279 |
280 // Target bounds of a docked window being dragged. | 280 // Target bounds of a docked window being dragged. |
281 gfx::Rect dragged_bounds_; | 281 gfx::Rect dragged_bounds_; |
282 | 282 |
283 // Side of the screen that the dock is positioned at. | 283 // Side of the screen that the dock is positioned at. |
284 DockedAlignment alignment_; | 284 DockedAlignment alignment_; |
285 | 285 |
286 // The last active window. Used to maintain stacking order even if no windows | 286 // The last active window. Used to maintain stacking order even if no windows |
287 // are currently focused. | 287 // are currently focused. |
288 aura::Window* last_active_window_; | 288 aura::Window* last_active_window_; |
289 | 289 |
290 // Timestamp of the last user-initiated action that changed docked state. | 290 // Timestamp of the last user-initiated action that changed docked state. |
291 // Used in UMA metrics. | 291 // Used in UMA metrics. |
292 base::Time last_action_time_; | 292 base::Time last_action_time_; |
293 | 293 |
294 // Observes launcher shelf for bounds changes. | 294 // Observes shelf for bounds changes. |
295 scoped_ptr<ShelfWindowObserver> shelf_observer_; | 295 scoped_ptr<ShelfWindowObserver> shelf_observer_; |
296 | 296 |
297 // Widget used to paint a background for the docked area. | 297 // Widget used to paint a background for the docked area. |
298 scoped_ptr<DockedBackgroundWidget> background_widget_; | 298 scoped_ptr<DockedBackgroundWidget> background_widget_; |
299 | 299 |
300 // Observers of dock bounds changes. | 300 // Observers of dock bounds changes. |
301 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 301 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
302 | 302 |
303 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 303 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
304 }; | 304 }; |
305 | 305 |
306 } // namespace internal | 306 } // namespace internal |
307 } // namespace ash | 307 } // namespace ash |
308 | 308 |
309 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 309 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |