| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void DockDraggedWindow(aura::Window* window); | 100 void DockDraggedWindow(aura::Window* window); |
| 101 | 101 |
| 102 // Called by a DockedWindowResizer when a dragged window is no longer docked. | 102 // Called by a DockedWindowResizer when a dragged window is no longer docked. |
| 103 void UndockDraggedWindow(); | 103 void UndockDraggedWindow(); |
| 104 | 104 |
| 105 // Called by a DockedWindowResizer when a window is no longer being dragged. | 105 // Called by a DockedWindowResizer when a window is no longer being dragged. |
| 106 // Stops observing the window unless it is a child. | 106 // Stops observing the window unless it is a child. |
| 107 // Records |action| by |source| in UMA. | 107 // Records |action| by |source| in UMA. |
| 108 void FinishDragging(DockedAction action, DockedActionSource source); | 108 void FinishDragging(DockedAction action, DockedActionSource source); |
| 109 | 109 |
| 110 // Checks the rules and possibly updates the docked layout to match |
| 111 // the |alignment|. May not apply the |alignment| when |
| 112 // the current shelf alignment conflicts. Never clears the |alignment_|. |
| 113 void MaybeSetDesiredDockedAlignment(DockedAlignment alignment); |
| 114 |
| 110 Shelf* shelf() { return shelf_; } | 115 Shelf* shelf() { return shelf_; } |
| 111 void SetShelf(Shelf* shelf); | 116 void SetShelf(Shelf* shelf); |
| 112 | 117 |
| 113 // Calculates if a window is touching the screen edges and returns edge. | 118 // Calculates if a window is touching the screen edges and returns edge. |
| 114 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; | 119 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; |
| 115 | 120 |
| 116 // Used to snap docked windows to the side of screen during drag. | 121 // Used to snap docked windows to the side of screen during drag. |
| 117 DockedAlignment CalculateAlignment() const; | 122 DockedAlignment CalculateAlignment() const; |
| 118 | 123 |
| 119 // Returns true when a window can be docked. Windows cannot be docked at the | 124 // Returns true when a window can be docked. Windows cannot be docked at the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 class ShelfWindowObserver; | 181 class ShelfWindowObserver; |
| 177 friend class DockedWindowLayoutManagerTest; | 182 friend class DockedWindowLayoutManagerTest; |
| 178 friend class DockedWindowResizerTest; | 183 friend class DockedWindowResizerTest; |
| 179 | 184 |
| 180 // Width of the gap between the docked windows and a workspace. | 185 // Width of the gap between the docked windows and a workspace. |
| 181 static const int kMinDockGap; | 186 static const int kMinDockGap; |
| 182 | 187 |
| 183 // Ideal (starting) width of the dock. | 188 // Ideal (starting) width of the dock. |
| 184 static const int kIdealWidth; | 189 static const int kIdealWidth; |
| 185 | 190 |
| 191 // Returns the alignment of the docked windows other than the |child|. |
| 192 DockedAlignment CalculateAlignmentExcept(const aura::Window* child) const; |
| 193 |
| 194 // Determines if the |alignment| is applicable taking into account |
| 195 // the shelf alignment. |
| 196 bool IsDockedAlignmentValid(DockedAlignment alignment) const; |
| 197 |
| 186 // Keep at most kMaxVisibleWindows visible in the dock and minimize the rest | 198 // Keep at most kMaxVisibleWindows visible in the dock and minimize the rest |
| 187 // (except for |child|). | 199 // (except for |child|). |
| 188 void MaybeMinimizeChildrenExcept(aura::Window* child); | 200 void MaybeMinimizeChildrenExcept(aura::Window* child); |
| 189 | 201 |
| 190 // Minimize / restore window and relayout. | 202 // Minimize / restore window and relayout. |
| 191 void MinimizeDockedWindow(wm::WindowState* window_state); | 203 void MinimizeDockedWindow(wm::WindowState* window_state); |
| 192 void RestoreDockedWindow(wm::WindowState* window_state); | 204 void RestoreDockedWindow(wm::WindowState* window_state); |
| 193 | 205 |
| 194 // Record user-initiated |action| by |source| in UMA metrics. | 206 // Record user-initiated |action| by |source| in UMA metrics. |
| 195 void RecordUmaAction(DockedAction action, DockedActionSource source); | 207 void RecordUmaAction(DockedAction action, DockedActionSource source); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 315 |
| 304 // Observers of dock bounds changes. | 316 // Observers of dock bounds changes. |
| 305 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 317 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
| 306 | 318 |
| 307 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 319 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
| 308 }; | 320 }; |
| 309 | 321 |
| 310 } // namespace ash | 322 } // namespace ash |
| 311 | 323 |
| 312 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 324 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |