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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/keyboard/keyboard_controller_observer.h" | 23 #include "ui/keyboard/keyboard_controller_observer.h" |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 class DockedBackgroundWidget; | 26 class DockedBackgroundWidget; |
27 class DockedWindowLayoutManagerObserver; | 27 class DockedWindowLayoutManagerObserver; |
28 class DockedWindowResizerTest; | 28 class DockedWindowResizerTest; |
29 class Shelf; | 29 class Shelf; |
30 | 30 |
31 namespace wm { | 31 namespace wm { |
32 class WmRootWindowController; | 32 class WmRootWindowController; |
| 33 class WmShelf; |
33 } | 34 } |
34 | 35 |
35 // DockedWindowLayoutManager is responsible for organizing windows when they are | 36 // DockedWindowLayoutManager is responsible for organizing windows when they are |
36 // docked to the side of a screen. It is associated with a specific container | 37 // docked to the side of a screen. It is associated with a specific container |
37 // window (i.e. kShellWindowId_DockContainer) and controls the layout of any | 38 // window (i.e. kShellWindowId_DockContainer) and controls the layout of any |
38 // windows added to that container. | 39 // windows added to that container. |
39 // | 40 // |
40 // The constructor takes a |dock_container| argument which is expected to set | 41 // The constructor takes a |dock_container| argument which is expected to set |
41 // its layout manager to this instance, e.g.: | 42 // its layout manager to this instance, e.g.: |
42 // dock_container->SetLayoutManager( | 43 // dock_container->SetLayoutManager( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Called by a DockedWindowResizer when a window is no longer being dragged. | 86 // Called by a DockedWindowResizer when a window is no longer being dragged. |
86 // Stops observing the window unless it is a child. | 87 // Stops observing the window unless it is a child. |
87 // Records |action| by |source| in UMA. | 88 // Records |action| by |source| in UMA. |
88 void FinishDragging(DockedAction action, DockedActionSource source); | 89 void FinishDragging(DockedAction action, DockedActionSource source); |
89 | 90 |
90 // Checks the rules and possibly updates the docked layout to match | 91 // Checks the rules and possibly updates the docked layout to match |
91 // the |alignment|. May not apply the |alignment| when | 92 // the |alignment|. May not apply the |alignment| when |
92 // the current shelf alignment conflicts. Never clears the |alignment_|. | 93 // the current shelf alignment conflicts. Never clears the |alignment_|. |
93 void MaybeSetDesiredDockedAlignment(DockedAlignment alignment); | 94 void MaybeSetDesiredDockedAlignment(DockedAlignment alignment); |
94 | 95 |
95 Shelf* shelf() { return shelf_; } | 96 wm::WmShelf* shelf() { return shelf_; } |
96 void SetShelf(Shelf* shelf); | 97 void SetShelf(wm::WmShelf* shelf); |
97 | 98 |
98 // Calculates if a window is touching the screen edges and returns edge. | 99 // Calculates if a window is touching the screen edges and returns edge. |
99 DockedAlignment GetAlignmentOfWindow(const wm::WmWindow* window) const; | 100 DockedAlignment GetAlignmentOfWindow(const wm::WmWindow* window) const; |
100 | 101 |
101 // Used to snap docked windows to the side of screen during drag. | 102 // Used to snap docked windows to the side of screen during drag. |
102 DockedAlignment CalculateAlignment() const; | 103 DockedAlignment CalculateAlignment() const; |
103 | 104 |
104 void set_preferred_alignment(DockedAlignment preferred_alignment) { | 105 void set_preferred_alignment(DockedAlignment preferred_alignment) { |
105 preferred_alignment_ = preferred_alignment; | 106 preferred_alignment_ = preferred_alignment; |
106 } | 107 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 261 |
261 // True if the window being dragged is currently docked. | 262 // True if the window being dragged is currently docked. |
262 bool is_dragged_window_docked_; | 263 bool is_dragged_window_docked_; |
263 | 264 |
264 // Previously docked windows use a more relaxed dragging sorting algorithm | 265 // Previously docked windows use a more relaxed dragging sorting algorithm |
265 // that uses assumption that a window starts being dragged out of position | 266 // that uses assumption that a window starts being dragged out of position |
266 // that was previously established in Relayout. This allows easier reordering. | 267 // that was previously established in Relayout. This allows easier reordering. |
267 bool is_dragged_from_dock_; | 268 bool is_dragged_from_dock_; |
268 | 269 |
269 // The shelf to respond to alignment changes. | 270 // The shelf to respond to alignment changes. |
270 Shelf* shelf_; | 271 wm::WmShelf* shelf_; |
271 | 272 |
272 // Tracks if any window in the same root window is in fullscreen mode. | 273 // Tracks if any window in the same root window is in fullscreen mode. |
273 bool in_fullscreen_; | 274 bool in_fullscreen_; |
274 // Current width of the dock. | 275 // Current width of the dock. |
275 int docked_width_; | 276 int docked_width_; |
276 | 277 |
277 // Last bounds that were sent to observers. | 278 // Last bounds that were sent to observers. |
278 gfx::Rect docked_bounds_; | 279 gfx::Rect docked_bounds_; |
279 | 280 |
280 // Target bounds of a docked window being dragged. | 281 // Target bounds of a docked window being dragged. |
(...skipping 24 matching lines...) Expand all Loading... |
305 | 306 |
306 // Observers of dock bounds changes. | 307 // Observers of dock bounds changes. |
307 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 308 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
308 | 309 |
309 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 310 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
310 }; | 311 }; |
311 | 312 |
312 } // namespace ash | 313 } // namespace ash |
313 | 314 |
314 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 315 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |