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_MANAGER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
12 #include "ash/wm/window_state_observer.h" | 12 #include "ash/wm/window_state_observer.h" |
13 #include "ash/wm/wm_types.h" | 13 #include "ash/wm/wm_types.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/memory/scoped_ptr.h" |
16 #include "ui/aura/client/activation_change_observer.h" | 17 #include "ui/aura/client/activation_change_observer.h" |
17 #include "ui/aura/layout_manager.h" | 18 #include "ui/aura/layout_manager.h" |
18 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 | 21 |
21 namespace aura { | 22 namespace aura { |
22 class RootWindow; | 23 class RootWindow; |
23 class Window; | 24 class Window; |
24 } | 25 } |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 class Layer; | 28 class Layer; |
28 } | 29 } |
29 | 30 |
30 namespace ash { | 31 namespace ash { |
31 namespace wm { | 32 namespace wm { |
32 class WindowState; | 33 class WindowState; |
33 class WMEvent; | 34 class WMEvent; |
34 } | 35 } |
35 | 36 |
36 namespace internal { | 37 namespace internal { |
37 | 38 |
38 class ShelfLayoutManager; | 39 class ShelfLayoutManager; |
| 40 class WorkspaceLayoutManagerDelegate; |
39 | 41 |
40 // LayoutManager used on the window created for a workspace. | 42 // LayoutManager used on the window created for a workspace. |
41 class ASH_EXPORT WorkspaceLayoutManager | 43 class ASH_EXPORT WorkspaceLayoutManager |
42 : public aura::LayoutManager, | 44 : public aura::LayoutManager, |
43 public aura::WindowObserver, | 45 public aura::WindowObserver, |
44 public aura::client::ActivationChangeObserver, | 46 public aura::client::ActivationChangeObserver, |
45 public ShellObserver, | 47 public ShellObserver, |
46 public wm::WindowStateObserver { | 48 public wm::WindowStateObserver { |
47 public: | 49 public: |
48 explicit WorkspaceLayoutManager(aura::Window* window); | 50 explicit WorkspaceLayoutManager(aura::Window* window); |
49 virtual ~WorkspaceLayoutManager(); | 51 virtual ~WorkspaceLayoutManager(); |
50 | 52 |
51 void SetShelf(internal::ShelfLayoutManager* shelf); | 53 void SetShelf(internal::ShelfLayoutManager* shelf); |
52 | 54 |
| 55 // A delegate which can be set to add a backdrop behind the top most visible |
| 56 // window. With the call the ownership of the delegate will be transferred to |
| 57 // the WorkspaceLayoutManager. |
| 58 void SetMaximizeBackdropDelegate( |
| 59 scoped_ptr<WorkspaceLayoutManagerDelegate> delegate); |
| 60 |
53 // Overridden from aura::LayoutManager: | 61 // Overridden from aura::LayoutManager: |
54 virtual void OnWindowResized() OVERRIDE {} | 62 virtual void OnWindowResized() OVERRIDE {} |
55 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 63 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
56 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 64 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
57 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 65 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
58 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 66 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
59 bool visibile) OVERRIDE; | 67 bool visibile) OVERRIDE; |
60 virtual void SetChildBounds(aura::Window* child, | 68 virtual void SetChildBounds(aura::Window* child, |
61 const gfx::Rect& requested_bounds) OVERRIDE; | 69 const gfx::Rect& requested_bounds) OVERRIDE; |
62 | 70 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // is on display. | 104 // is on display. |
97 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); | 105 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); |
98 | 106 |
99 // Updates the visibility state of the shelf. | 107 // Updates the visibility state of the shelf. |
100 void UpdateShelfVisibility(); | 108 void UpdateShelfVisibility(); |
101 | 109 |
102 // Updates the fullscreen state of the workspace and notifies Shell if it | 110 // Updates the fullscreen state of the workspace and notifies Shell if it |
103 // has changed. | 111 // has changed. |
104 void UpdateFullscreenState(); | 112 void UpdateFullscreenState(); |
105 | 113 |
| 114 // Updates the bounds of the window for a stte type change from |
| 115 // |old_show_type|. |
| 116 void UpdateBoundsFromStateType(wm::WindowState* window_state, |
| 117 wm::WindowStateType old_state_type); |
| 118 |
| 119 // If |window_state| is maximized or fullscreen the bounds of the |
| 120 // window are set and true is returned. Does nothing otherwise. |
| 121 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); |
| 122 |
| 123 // Animates the window bounds to |bounds|. |
| 124 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); |
| 125 |
106 internal::ShelfLayoutManager* shelf_; | 126 internal::ShelfLayoutManager* shelf_; |
107 aura::Window* window_; | 127 aura::Window* window_; |
108 aura::Window* root_window_; | 128 aura::Window* root_window_; |
109 | 129 |
110 // Set of windows we're listening to. | 130 // Set of windows we're listening to. |
111 WindowSet windows_; | 131 WindowSet windows_; |
112 | 132 |
113 // The work area in the coordinates of |window_|. | 133 // The work area in the coordinates of |window_|. |
114 gfx::Rect work_area_in_parent_; | 134 gfx::Rect work_area_in_parent_; |
115 | 135 |
116 // True if this workspace is currently in fullscreen mode. | 136 // True if this workspace is currently in fullscreen mode. |
117 bool is_fullscreen_; | 137 bool is_fullscreen_; |
118 | 138 |
| 139 // A window which covers the full container and which gets inserted behind the |
| 140 // topmost visible window. |
| 141 scoped_ptr<WorkspaceLayoutManagerDelegate> backdrop_delegate_; |
| 142 |
119 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 143 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
120 }; | 144 }; |
121 | 145 |
122 } // namespace internal | 146 } // namespace internal |
123 } // namespace ash | 147 } // namespace ash |
124 | 148 |
125 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 149 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
OLD | NEW |