| 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" |
| 11 #include "ash/shell_observer.h" | |
| 12 #include "ash/wm/common/wm_activation_observer.h" | 11 #include "ash/wm/common/wm_activation_observer.h" |
| 12 #include "ash/wm/common/wm_root_window_controller_observer.h" |
| 13 #include "ash/wm/common/wm_snap_to_pixel_layout_manager.h" | 13 #include "ash/wm/common/wm_snap_to_pixel_layout_manager.h" |
| 14 #include "ash/wm/common/wm_window_observer.h" | 14 #include "ash/wm/common/wm_window_observer.h" |
| 15 #include "ash/wm/dock/dock_types.h" | 15 #include "ash/wm/dock/dock_types.h" |
| 16 #include "ash/wm/dock/docked_window_layout_manager_observer.h" | 16 #include "ash/wm/dock/docked_window_layout_manager_observer.h" |
| 17 #include "ash/wm/window_state_observer.h" | 17 #include "ash/wm/window_state_observer.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 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 aura { | |
| 26 class Window; | |
| 27 } | |
| 28 | |
| 29 namespace gfx { | |
| 30 class Point; | |
| 31 } | |
| 32 | |
| 33 namespace views { | |
| 34 class Widget; | |
| 35 } | |
| 36 | |
| 37 namespace ash { | 25 namespace ash { |
| 38 class DockedBackgroundWidget; | 26 class DockedBackgroundWidget; |
| 39 class DockedWindowLayoutManagerObserver; | 27 class DockedWindowLayoutManagerObserver; |
| 40 class DockedWindowResizerTest; | 28 class DockedWindowResizerTest; |
| 41 class Shelf; | 29 class Shelf; |
| 42 class WorkspaceController; | 30 class WorkspaceController; |
| 43 | 31 |
| 32 namespace wm { |
| 33 class WmRootWindowController; |
| 34 } |
| 35 |
| 44 // DockedWindowLayoutManager is responsible for organizing windows when they are | 36 // DockedWindowLayoutManager is responsible for organizing windows when they are |
| 45 // 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 |
| 46 // window (i.e. kShellWindowId_DockContainer) and controls the layout of any | 38 // window (i.e. kShellWindowId_DockContainer) and controls the layout of any |
| 47 // windows added to that container. | 39 // windows added to that container. |
| 48 // | 40 // |
| 49 // 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 |
| 50 // its layout manager to this instance, e.g.: | 42 // its layout manager to this instance, e.g.: |
| 51 // dock_container->SetLayoutManager( | 43 // dock_container->SetLayoutManager( |
| 52 // new DockedWindowLayoutManager(dock_container)); | 44 // new DockedWindowLayoutManager(dock_container)); |
| 53 // | 45 // |
| 54 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit | 46 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit |
| 55 // common functionality. | 47 // common functionality. |
| 56 class ASH_EXPORT DockedWindowLayoutManager | 48 class ASH_EXPORT DockedWindowLayoutManager |
| 57 : public wm::WmSnapToPixelLayoutManager, | 49 : public wm::WmSnapToPixelLayoutManager, |
| 58 public ash::ShellObserver, | 50 public wm::WmRootWindowControllerObserver, |
| 59 public wm::WmWindowObserver, | 51 public wm::WmWindowObserver, |
| 60 public wm::WmActivationObserver, | 52 public wm::WmActivationObserver, |
| 61 public keyboard::KeyboardControllerObserver, | 53 public keyboard::KeyboardControllerObserver, |
| 62 public wm::WindowStateObserver { | 54 public wm::WindowStateObserver { |
| 63 public: | 55 public: |
| 64 // Maximum width of the docked windows area. | 56 // Maximum width of the docked windows area. |
| 65 static const int kMaxDockWidth; | 57 static const int kMaxDockWidth; |
| 66 | 58 |
| 67 // Minimum width of the docked windows area. | 59 // Minimum width of the docked windows area. |
| 68 static const int kMinDockWidth; | 60 static const int kMinDockWidth; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // SnapLayoutManager: | 132 // SnapLayoutManager: |
| 141 void OnWindowResized() override; | 133 void OnWindowResized() override; |
| 142 void OnWindowAddedToLayout(wm::WmWindow* child) override; | 134 void OnWindowAddedToLayout(wm::WmWindow* child) override; |
| 143 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override {} | 135 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override {} |
| 144 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; | 136 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; |
| 145 void OnChildWindowVisibilityChanged(wm::WmWindow* child, | 137 void OnChildWindowVisibilityChanged(wm::WmWindow* child, |
| 146 bool visibile) override; | 138 bool visibile) override; |
| 147 void SetChildBounds(wm::WmWindow* child, | 139 void SetChildBounds(wm::WmWindow* child, |
| 148 const gfx::Rect& requested_bounds) override; | 140 const gfx::Rect& requested_bounds) override; |
| 149 | 141 |
| 150 // ash::ShellObserver: | 142 // wm::WmRootWindowControllerObserver: |
| 151 void OnDisplayWorkAreaInsetsChanged() override; | 143 void OnWorkAreaChanged() override; |
| 152 void OnFullscreenStateChanged(bool is_fullscreen, | 144 void OnFullscreenStateChanged(bool is_fullscreen) override; |
| 153 aura::Window* root_window) override; | 145 void OnShelfAlignmentChanged() override; |
| 154 void OnShelfAlignmentChanged(aura::Window* root_window) override; | |
| 155 | 146 |
| 156 // wm::WindowStateObserver: | 147 // wm::WindowStateObserver: |
| 157 void OnPreWindowStateTypeChange(wm::WindowState* window_state, | 148 void OnPreWindowStateTypeChange(wm::WindowState* window_state, |
| 158 wm::WindowStateType old_type) override; | 149 wm::WindowStateType old_type) override; |
| 159 | 150 |
| 160 // wm::WmWindowObserver: | 151 // wm::WmWindowObserver: |
| 161 void OnWindowBoundsChanged(wm::WmWindow* window, | 152 void OnWindowBoundsChanged(wm::WmWindow* window, |
| 162 const gfx::Rect& old_bounds, | 153 const gfx::Rect& old_bounds, |
| 163 const gfx::Rect& new_bounds) override; | 154 const gfx::Rect& new_bounds) override; |
| 164 void OnWindowVisibilityChanging(wm::WmWindow* window, bool visible) override; | 155 void OnWindowVisibilityChanging(wm::WmWindow* window, bool visible) override; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 241 |
| 251 // Called whenever the window stacking order needs to be updated (e.g. focus | 242 // Called whenever the window stacking order needs to be updated (e.g. focus |
| 252 // changes or a window is moved). | 243 // changes or a window is moved). |
| 253 void UpdateStacking(wm::WmWindow* active_window); | 244 void UpdateStacking(wm::WmWindow* active_window); |
| 254 | 245 |
| 255 // keyboard::KeyboardControllerObserver: | 246 // keyboard::KeyboardControllerObserver: |
| 256 void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; | 247 void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; |
| 257 | 248 |
| 258 // Parent window associated with this layout manager. | 249 // Parent window associated with this layout manager. |
| 259 wm::WmWindow* dock_container_; | 250 wm::WmWindow* dock_container_; |
| 251 |
| 252 wm::WmRootWindowController* root_window_controller_; |
| 253 |
| 260 // Protect against recursive calls to Relayout(). | 254 // Protect against recursive calls to Relayout(). |
| 261 bool in_layout_; | 255 bool in_layout_; |
| 262 | 256 |
| 263 // A window that is being dragged (whether docked or not). | 257 // A window that is being dragged (whether docked or not). |
| 264 // Windows are tracked by docked layout manager only if they are docked; | 258 // Windows are tracked by docked layout manager only if they are docked; |
| 265 // however we need to know if a window is being dragged in order to avoid | 259 // however we need to know if a window is being dragged in order to avoid |
| 266 // positioning it or even considering it for layout. | 260 // positioning it or even considering it for layout. |
| 267 wm::WmWindow* dragged_window_; | 261 wm::WmWindow* dragged_window_; |
| 268 | 262 |
| 269 // True if the window being dragged is currently docked. | 263 // True if the window being dragged is currently docked. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 309 |
| 316 // Observers of dock bounds changes. | 310 // Observers of dock bounds changes. |
| 317 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 311 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
| 318 | 312 |
| 319 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 313 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
| 320 }; | 314 }; |
| 321 | 315 |
| 322 } // namespace ash | 316 } // namespace ash |
| 323 | 317 |
| 324 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 318 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |