| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit | 54 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit |
| 55 // common functionality. | 55 // common functionality. |
| 56 class ASH_EXPORT DockedWindowLayoutManager | 56 class ASH_EXPORT DockedWindowLayoutManager |
| 57 : public aura::LayoutManager, | 57 : public aura::LayoutManager, |
| 58 public ash::ShellObserver, | 58 public ash::ShellObserver, |
| 59 public aura::WindowObserver, | 59 public aura::WindowObserver, |
| 60 public aura::client::ActivationChangeObserver, | 60 public aura::client::ActivationChangeObserver, |
| 61 public keyboard::KeyboardControllerObserver, | 61 public keyboard::KeyboardControllerObserver, |
| 62 public ash::ShelfLayoutManagerObserver { | 62 public ash::ShelfLayoutManagerObserver { |
| 63 public: | 63 public: |
| 64 // Maximum width of the docked windows area. |
| 65 static const int kMaxDockWidth; |
| 66 |
| 64 explicit DockedWindowLayoutManager(aura::Window* dock_container); | 67 explicit DockedWindowLayoutManager(aura::Window* dock_container); |
| 65 virtual ~DockedWindowLayoutManager(); | 68 virtual ~DockedWindowLayoutManager(); |
| 66 | 69 |
| 67 // Disconnects observers before container windows get destroyed. | 70 // Disconnects observers before container windows get destroyed. |
| 68 void Shutdown(); | 71 void Shutdown(); |
| 69 | 72 |
| 70 // Management of the observer list. | 73 // Management of the observer list. |
| 71 virtual void AddObserver(DockedWindowLayoutManagerObserver* observer); | 74 virtual void AddObserver(DockedWindowLayoutManagerObserver* observer); |
| 72 virtual void RemoveObserver(DockedWindowLayoutManagerObserver* observer); | 75 virtual void RemoveObserver(DockedWindowLayoutManagerObserver* observer); |
| 73 | 76 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 95 DockedAlignment CalculateAlignment() const; | 98 DockedAlignment CalculateAlignment() const; |
| 96 | 99 |
| 97 aura::Window* dock_container() const { return dock_container_; } | 100 aura::Window* dock_container() const { return dock_container_; } |
| 98 | 101 |
| 99 // Returns current bounding rectangle of docked windows area. | 102 // Returns current bounding rectangle of docked windows area. |
| 100 const gfx::Rect& docked_bounds() const { return docked_bounds_; } | 103 const gfx::Rect& docked_bounds() const { return docked_bounds_; } |
| 101 | 104 |
| 102 // Returns last known coordinates of |dragged_window_| after Relayout. | 105 // Returns last known coordinates of |dragged_window_| after Relayout. |
| 103 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} | 106 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} |
| 104 | 107 |
| 108 // Returns true if currently dragged window is docked at the screen edge. |
| 109 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } |
| 110 |
| 105 // aura::LayoutManager: | 111 // aura::LayoutManager: |
| 106 virtual void OnWindowResized() OVERRIDE; | 112 virtual void OnWindowResized() OVERRIDE; |
| 107 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 113 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 108 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | 114 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
| 109 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 115 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 110 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 116 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 111 bool visibile) OVERRIDE; | 117 bool visibile) OVERRIDE; |
| 112 virtual void SetChildBounds(aura::Window* child, | 118 virtual void SetChildBounds(aura::Window* child, |
| 113 const gfx::Rect& requested_bounds) OVERRIDE; | 119 const gfx::Rect& requested_bounds) OVERRIDE; |
| 114 | 120 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 137 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, AttachWindowMaximizeOther); | 143 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, AttachWindowMaximizeOther); |
| 138 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, AttachOneTestSticky); | 144 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, AttachOneTestSticky); |
| 139 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, ResizeTwoWindows); | 145 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, ResizeTwoWindows); |
| 140 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, DragToShelf); | 146 FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, DragToShelf); |
| 141 friend class DockedWindowLayoutManagerTest; | 147 friend class DockedWindowLayoutManagerTest; |
| 142 friend class DockedWindowResizerTest; | 148 friend class DockedWindowResizerTest; |
| 143 | 149 |
| 144 // Minimum width of the docked windows area. | 150 // Minimum width of the docked windows area. |
| 145 static const int kMinDockWidth; | 151 static const int kMinDockWidth; |
| 146 | 152 |
| 147 // Maximum width of the docked windows area. | |
| 148 static const int kMaxDockWidth; | |
| 149 | |
| 150 // Width of the gap between the docked windows and a workspace. | 153 // Width of the gap between the docked windows and a workspace. |
| 151 static const int kMinDockGap; | 154 static const int kMinDockGap; |
| 152 | 155 |
| 153 // Minimize / restore window and relayout. | 156 // Minimize / restore window and relayout. |
| 154 void MinimizeWindow(aura::Window* window); | 157 void MinimizeWindow(aura::Window* window); |
| 155 void RestoreWindow(aura::Window* window); | 158 void RestoreWindow(aura::Window* window); |
| 156 | 159 |
| 157 // Updates docked layout state when a window gets inside the dock. | 160 // Updates docked layout state when a window gets inside the dock. |
| 158 void OnWindowDocked(aura::Window* window); | 161 void OnWindowDocked(aura::Window* window); |
| 159 | 162 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Observers of dock bounds changes. | 229 // Observers of dock bounds changes. |
| 227 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 230 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
| 228 | 231 |
| 229 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 232 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
| 230 }; | 233 }; |
| 231 | 234 |
| 232 } // namespace internal | 235 } // namespace internal |
| 233 } // namespace ash | 236 } // namespace ash |
| 234 | 237 |
| 235 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 238 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |