| 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" |
| 11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
| 12 #include "ash/common/wm/dock/dock_types.h" | 12 #include "ash/common/wm/dock/dock_types.h" |
| 13 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" | 13 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" |
| 14 #include "ash/common/wm/window_state_observer.h" | 14 #include "ash/common/wm/window_state_observer.h" |
| 15 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | 15 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
| 16 #include "ash/common/wm_activation_observer.h" | 16 #include "ash/common/wm_activation_observer.h" |
| 17 #include "ash/common/wm_window_observer.h" | |
| 18 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| 20 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "ui/aura/window_observer.h" |
| 22 #include "ui/display/display_observer.h" | 22 #include "ui/display/display_observer.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
| 24 #include "ui/keyboard/keyboard_controller_observer.h" | 24 #include "ui/keyboard/keyboard_controller_observer.h" |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 class DockedBackgroundWidget; | 27 class DockedBackgroundWidget; |
| 28 class DockedWindowLayoutManagerObserver; | 28 class DockedWindowLayoutManagerObserver; |
| 29 class DockedWindowResizerTest; | 29 class DockedWindowResizerTest; |
| 30 class RootWindowController; | 30 class RootWindowController; |
| 31 class WmShelf; | 31 class WmShelf; |
| 32 | 32 |
| 33 // DockedWindowLayoutManager is responsible for organizing windows when they are | 33 // DockedWindowLayoutManager is responsible for organizing windows when they are |
| 34 // 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 |
| 35 // window (i.e. kShellWindowId_DockedContainer) and controls the layout of any | 35 // window (i.e. kShellWindowId_DockedContainer) and controls the layout of any |
| 36 // windows added to that container. | 36 // windows added to that container. |
| 37 // | 37 // |
| 38 // 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 |
| 39 // its layout manager to this instance, e.g.: | 39 // its layout manager to this instance, e.g.: |
| 40 // dock_container->SetLayoutManager( | 40 // dock_container->SetLayoutManager( |
| 41 // new DockedWindowLayoutManager(dock_container)); | 41 // new DockedWindowLayoutManager(dock_container)); |
| 42 // | 42 // |
| 43 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit | 43 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit |
| 44 // common functionality. | 44 // common functionality. |
| 45 class ASH_EXPORT DockedWindowLayoutManager | 45 class ASH_EXPORT DockedWindowLayoutManager |
| 46 : public wm::WmSnapToPixelLayoutManager, | 46 : public wm::WmSnapToPixelLayoutManager, |
| 47 public display::DisplayObserver, | 47 public display::DisplayObserver, |
| 48 public WmWindowObserver, | 48 public aura::WindowObserver, |
| 49 public WmActivationObserver, | 49 public WmActivationObserver, |
| 50 public ShellObserver, | 50 public ShellObserver, |
| 51 public keyboard::KeyboardControllerObserver, | 51 public keyboard::KeyboardControllerObserver, |
| 52 public wm::WindowStateObserver { | 52 public wm::WindowStateObserver { |
| 53 public: | 53 public: |
| 54 // Maximum width of the docked windows area. | 54 // Maximum width of the docked windows area. |
| 55 static const int kMaxDockWidth; | 55 static const int kMaxDockWidth; |
| 56 | 56 |
| 57 // Minimum width of the docked windows area. | 57 // Minimum width of the docked windows area. |
| 58 static const int kMinDockWidth; | 58 static const int kMinDockWidth; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 const gfx::Rect& requested_bounds) override; | 136 const gfx::Rect& requested_bounds) override; |
| 137 | 137 |
| 138 // display::DisplayObserver: | 138 // display::DisplayObserver: |
| 139 void OnDisplayMetricsChanged(const display::Display& display, | 139 void OnDisplayMetricsChanged(const display::Display& display, |
| 140 uint32_t changed_metrics) override; | 140 uint32_t changed_metrics) override; |
| 141 | 141 |
| 142 // wm::WindowStateObserver: | 142 // wm::WindowStateObserver: |
| 143 void OnPreWindowStateTypeChange(wm::WindowState* window_state, | 143 void OnPreWindowStateTypeChange(wm::WindowState* window_state, |
| 144 wm::WindowStateType old_type) override; | 144 wm::WindowStateType old_type) override; |
| 145 | 145 |
| 146 // WmWindowObserver: | 146 // aura::WindowObserver: |
| 147 void OnWindowBoundsChanged(WmWindow* window, | 147 void OnWindowBoundsChanged(aura::Window* window, |
| 148 const gfx::Rect& old_bounds, | 148 const gfx::Rect& old_bounds, |
| 149 const gfx::Rect& new_bounds) override; | 149 const gfx::Rect& new_bounds) override; |
| 150 void OnWindowVisibilityChanging(WmWindow* window, bool visible) override; | 150 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; |
| 151 void OnWindowDestroying(WmWindow* window) override; | 151 void OnWindowDestroying(aura::Window* window) override; |
| 152 | 152 |
| 153 // WmActivationObserver: | 153 // WmActivationObserver: |
| 154 void OnWindowActivated(WmWindow* gained_active, | 154 void OnWindowActivated(WmWindow* gained_active, |
| 155 WmWindow* lost_active) override; | 155 WmWindow* lost_active) override; |
| 156 | 156 |
| 157 // ShellObserver: | 157 // ShellObserver: |
| 158 void OnShelfAlignmentChanged(WmWindow* root_window) override; | 158 void OnShelfAlignmentChanged(WmWindow* root_window) override; |
| 159 void OnFullscreenStateChanged(bool is_fullscreen, | 159 void OnFullscreenStateChanged(bool is_fullscreen, |
| 160 WmWindow* root_window) override; | 160 WmWindow* root_window) override; |
| 161 void OnOverviewModeStarting() override; | 161 void OnOverviewModeStarting() override; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 // Observers of dock bounds changes. | 314 // Observers of dock bounds changes. |
| 315 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 315 base::ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
| 316 | 316 |
| 317 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 317 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
| 318 }; | 318 }; |
| 319 | 319 |
| 320 } // namespace ash | 320 } // namespace ash |
| 321 | 321 |
| 322 #endif // ASH_COMMON_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 322 #endif // ASH_COMMON_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |