Chromium Code Reviews| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 114 |
| 115 Shelf* shelf() { return shelf_; } | 115 Shelf* shelf() { return shelf_; } |
| 116 void SetShelf(Shelf* shelf); | 116 void SetShelf(Shelf* shelf); |
| 117 | 117 |
| 118 // 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. |
| 119 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; | 119 DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; |
| 120 | 120 |
| 121 // 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. |
| 122 DockedAlignment CalculateAlignment() const; | 122 DockedAlignment CalculateAlignment() const; |
| 123 | 123 |
| 124 void set_preferred_alignment(DockedAlignment preferred_alignment) { | |
| 125 preferred_alignment_ = preferred_alignment; | |
| 126 } | |
| 127 | |
| 124 // Returns true when a window can be docked. Windows cannot be docked at the | 128 // Returns true when a window can be docked. Windows cannot be docked at the |
| 125 // edge used by the shelf or the edge opposite from existing dock. | 129 // edge used by the shelf or the edge opposite from existing dock. |
| 126 bool CanDockWindow(aura::Window* window, DockedAlignment desired_alignment); | 130 bool CanDockWindow(aura::Window* window, DockedAlignment desired_alignment); |
| 127 | 131 |
| 128 aura::Window* dock_container() const { return dock_container_; } | 132 aura::Window* dock_container() const { return dock_container_; } |
| 129 | 133 |
| 130 // Returns current bounding rectangle of docked windows area. | 134 // Returns current bounding rectangle of docked windows area. |
| 131 const gfx::Rect& docked_bounds() const { return docked_bounds_; } | 135 const gfx::Rect& docked_bounds() const { return docked_bounds_; } |
| 132 | 136 |
| 133 // Returns last known coordinates of |dragged_window_| after Relayout. | 137 // Returns last known coordinates of |dragged_window_| after Relayout. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 friend class DockedWindowResizerTest; | 187 friend class DockedWindowResizerTest; |
| 184 | 188 |
| 185 // Width of the gap between the docked windows and a workspace. | 189 // Width of the gap between the docked windows and a workspace. |
| 186 static const int kMinDockGap; | 190 static const int kMinDockGap; |
| 187 | 191 |
| 188 // Ideal (starting) width of the dock. | 192 // Ideal (starting) width of the dock. |
| 189 static const int kIdealWidth; | 193 static const int kIdealWidth; |
| 190 | 194 |
| 191 // Calculate the alignment of the dock; the children need to be traversed; | 195 // Calculate the alignment of the dock; the children need to be traversed; |
| 192 // and the |child| should be skipped in the calculation. The computed dock | 196 // and the |child| should be skipped in the calculation. The computed dock |
| 193 // alignment is returned. | 197 // alignment is returned. |
|
varkha
2014/09/30 20:31:03
This will probably get merged from the other patch
| |
| 194 DockedAlignment CalculateDockedAlignmentExcept(const aura::Window* child) | 198 DockedAlignment CalculateDockedAlignmentExcept(const aura::Window* child) |
| 195 const; | 199 const; |
| 196 | 200 |
| 197 // Determine if the |desired_alignment| is applicable taking into account | 201 // Determine if the |desired_alignment| is applicable taking into account |
| 198 // the location of the shelf. | 202 // the location of the shelf. |
| 199 bool IsDockedAlignmentApplicable(DockedAlignment desired_alignment) const; | 203 bool IsDockedAlignmentApplicable(DockedAlignment desired_alignment) const; |
| 200 | 204 |
| 201 // Keep at most kMaxVisibleWindows visible in the dock and minimize the rest | 205 // Keep at most kMaxVisibleWindows visible in the dock and minimize the rest |
| 202 // (except for |child|). | 206 // (except for |child|). |
| 203 void MaybeMinimizeChildrenExcept(aura::Window* child); | 207 void MaybeMinimizeChildrenExcept(aura::Window* child); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 | 299 |
| 296 // Last bounds that were sent to observers. | 300 // Last bounds that were sent to observers. |
| 297 gfx::Rect docked_bounds_; | 301 gfx::Rect docked_bounds_; |
| 298 | 302 |
| 299 // Target bounds of a docked window being dragged. | 303 // Target bounds of a docked window being dragged. |
| 300 gfx::Rect dragged_bounds_; | 304 gfx::Rect dragged_bounds_; |
| 301 | 305 |
| 302 // Side of the screen that the dock is positioned at. | 306 // Side of the screen that the dock is positioned at. |
| 303 DockedAlignment alignment_; | 307 DockedAlignment alignment_; |
| 304 | 308 |
| 309 // The preferred alignment of the next window to be added. | |
| 310 DockedAlignment preferred_alignment_; | |
| 311 | |
| 305 // The last active window. Used to maintain stacking order even if no windows | 312 // The last active window. Used to maintain stacking order even if no windows |
| 306 // are currently focused. | 313 // are currently focused. |
| 307 aura::Window* last_active_window_; | 314 aura::Window* last_active_window_; |
| 308 | 315 |
| 309 // Timestamp of the last user-initiated action that changed docked state. | 316 // Timestamp of the last user-initiated action that changed docked state. |
| 310 // Used in UMA metrics. | 317 // Used in UMA metrics. |
| 311 base::Time last_action_time_; | 318 base::Time last_action_time_; |
| 312 | 319 |
| 313 // Observes shelf for bounds changes. | 320 // Observes shelf for bounds changes. |
| 314 scoped_ptr<ShelfWindowObserver> shelf_observer_; | 321 scoped_ptr<ShelfWindowObserver> shelf_observer_; |
| 315 | 322 |
| 316 // Widget used to paint a background for the docked area. | 323 // Widget used to paint a background for the docked area. |
| 317 scoped_ptr<DockedBackgroundWidget> background_widget_; | 324 scoped_ptr<DockedBackgroundWidget> background_widget_; |
| 318 | 325 |
| 319 // Observers of dock bounds changes. | 326 // Observers of dock bounds changes. |
| 320 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 327 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
| 321 | 328 |
| 322 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 329 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
| 323 }; | 330 }; |
| 324 | 331 |
| 325 } // namespace ash | 332 } // namespace ash |
| 326 | 333 |
| 327 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 334 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |