| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/shell_observer.h" | 10 #include "ash/shell_observer.h" |
| 11 #include "ash/wm/base_layout_manager.h" | 11 #include "ash/wm/base_layout_manager.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "ui/aura/layout_manager.h" | 14 #include "ui/aura/layout_manager.h" |
| 15 #include "ui/aura/root_window_observer.h" | 15 #include "ui/aura/root_window_observer.h" |
| 16 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
| 17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 19 | 19 |
| 20 namespace aura { | 20 namespace aura { |
| 21 class RootWindow; | 21 class RootWindow; |
| 22 class Window; | 22 class Window; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace ui { | 25 namespace ui { |
| 26 class Layer; | 26 class Layer; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 | 30 |
| 31 // We force at least this many DIPs for any window on the screen. | 31 // We force at least this many DIPs for any window on the screen. |
| 32 const int kMinimumOnScreenArea = 10; | 32 const int kMinimumOnScreenArea = 10; |
| 33 | 33 |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 class Workspace2; | 36 class Workspace; |
| 37 class WorkspaceManager2; | 37 class WorkspaceManager; |
| 38 | 38 |
| 39 // LayoutManager used on the window created for a Workspace. | 39 // LayoutManager used on the window created for a Workspace. |
| 40 // TODO(sky): this code shares a fair amount of similarities with | 40 // TODO(sky): this code shares a fair amount of similarities with |
| 41 // BaseLayoutManager, yet its different enough that subclassing is painful. | 41 // BaseLayoutManager, yet its different enough that subclassing is painful. |
| 42 // See if I can refactor the code to make it easier to share common bits. | 42 // See if I can refactor the code to make it easier to share common bits. |
| 43 class ASH_EXPORT WorkspaceLayoutManager2 | 43 class ASH_EXPORT WorkspaceLayoutManager |
| 44 : public aura::LayoutManager, | 44 : public aura::LayoutManager, |
| 45 public aura::RootWindowObserver, | 45 public aura::RootWindowObserver, |
| 46 public ash::ShellObserver, | 46 public ash::ShellObserver, |
| 47 public aura::WindowObserver { | 47 public aura::WindowObserver { |
| 48 public: | 48 public: |
| 49 public: | 49 public: |
| 50 explicit WorkspaceLayoutManager2(Workspace2* workspace); | 50 explicit WorkspaceLayoutManager(Workspace* workspace); |
| 51 virtual ~WorkspaceLayoutManager2(); | 51 virtual ~WorkspaceLayoutManager(); |
| 52 | 52 |
| 53 // Overridden from BaseWorkspaceLayoutManager: | 53 // Overridden from BaseWorkspaceLayoutManager: |
| 54 virtual void OnWindowResized() OVERRIDE {} | 54 virtual void OnWindowResized() OVERRIDE {} |
| 55 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 55 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 56 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 56 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 57 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 57 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 58 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 58 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 59 bool visibile) OVERRIDE; | 59 bool visibile) OVERRIDE; |
| 60 virtual void SetChildBounds(aura::Window* child, | 60 virtual void SetChildBounds(aura::Window* child, |
| 61 const gfx::Rect& requested_bounds) OVERRIDE; | 61 const gfx::Rect& requested_bounds) OVERRIDE; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void AdjustWindowSizeForScreenChange(aura::Window* window, | 102 void AdjustWindowSizeForScreenChange(aura::Window* window, |
| 103 AdjustWindowReason reason); | 103 AdjustWindowReason reason); |
| 104 | 104 |
| 105 // Updates the bounds of the window from a show state change. | 105 // Updates the bounds of the window from a show state change. |
| 106 void UpdateBoundsFromShowState(aura::Window* window); | 106 void UpdateBoundsFromShowState(aura::Window* window); |
| 107 | 107 |
| 108 // If |window| is maximized or fullscreen the bounds of the window are set and | 108 // If |window| is maximized or fullscreen the bounds of the window are set and |
| 109 // true is returned. Does nothing otherwise. | 109 // true is returned. Does nothing otherwise. |
| 110 bool SetMaximizedOrFullscreenBounds(aura::Window* window); | 110 bool SetMaximizedOrFullscreenBounds(aura::Window* window); |
| 111 | 111 |
| 112 WorkspaceManager2* workspace_manager(); | 112 WorkspaceManager* workspace_manager(); |
| 113 | 113 |
| 114 aura::RootWindow* root_window_; | 114 aura::RootWindow* root_window_; |
| 115 | 115 |
| 116 Workspace2* workspace_; | 116 Workspace* workspace_; |
| 117 | 117 |
| 118 // Set of windows we're listening to. | 118 // Set of windows we're listening to. |
| 119 WindowSet windows_; | 119 WindowSet windows_; |
| 120 | 120 |
| 121 // The work area. Cached to avoid unnecessarily moving windows during a | 121 // The work area. Cached to avoid unnecessarily moving windows during a |
| 122 // workspace switch. | 122 // workspace switch. |
| 123 gfx::Rect work_area_; | 123 gfx::Rect work_area_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager2); | 125 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace internal | 128 } // namespace internal |
| 129 } // namespace ash | 129 } // namespace ash |
| 130 | 130 |
| 131 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_ | 131 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| OLD | NEW |