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