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 } | 34 } |
34 | 35 |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 class ShelfLayoutManager; | 38 class ShelfLayoutManager; |
| 39 class WorkspaceLayoutManagerBackdrop; |
38 | 40 |
39 // LayoutManager used on the window created for a workspace. | 41 // LayoutManager used on the window created for a workspace. |
40 class ASH_EXPORT WorkspaceLayoutManager | 42 class ASH_EXPORT WorkspaceLayoutManager |
41 : public aura::LayoutManager, | 43 : public aura::LayoutManager, |
42 public aura::WindowObserver, | 44 public aura::WindowObserver, |
43 public aura::client::ActivationChangeObserver, | 45 public aura::client::ActivationChangeObserver, |
44 public ShellObserver, | 46 public ShellObserver, |
45 public wm::WindowStateObserver { | 47 public wm::WindowStateObserver { |
46 public: | 48 public: |
47 explicit WorkspaceLayoutManager(aura::Window* window); | 49 explicit WorkspaceLayoutManager(aura::Window* window); |
48 virtual ~WorkspaceLayoutManager(); | 50 virtual ~WorkspaceLayoutManager(); |
49 | 51 |
50 void SetShelf(internal::ShelfLayoutManager* shelf); | 52 void SetShelf(internal::ShelfLayoutManager* shelf); |
51 | 53 |
| 54 // If enabled, the topmost window in the container will have a backdrop which |
| 55 // covers the rest of the container. |
| 56 void AddBackdropBehindTopWindow(bool enable); |
| 57 |
52 // Overridden from aura::LayoutManager: | 58 // Overridden from aura::LayoutManager: |
53 virtual void OnWindowResized() OVERRIDE {} | 59 virtual void OnWindowResized() OVERRIDE {} |
54 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 60 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
55 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 61 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
56 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 62 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
57 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 63 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
58 bool visibile) OVERRIDE; | 64 bool visibile) OVERRIDE; |
59 virtual void SetChildBounds(aura::Window* child, | 65 virtual void SetChildBounds(aura::Window* child, |
60 const gfx::Rect& requested_bounds) OVERRIDE; | 66 const gfx::Rect& requested_bounds) OVERRIDE; |
61 | 67 |
(...skipping 26 matching lines...) Expand all Loading... |
88 // If this is called for a display size change (i.e. |event| | 94 // If this is called for a display size change (i.e. |event| |
89 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen | 95 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen |
90 // windows are readjusted to make sure the window is completely within the | 96 // windows are readjusted to make sure the window is completely within the |
91 // display region. Otherwise, it makes sure at least some parts of the window | 97 // display region. Otherwise, it makes sure at least some parts of the window |
92 // is on display. | 98 // is on display. |
93 void AdjustAllWindowsBoundsForWorkAreaChange(wm::WMEvent event); | 99 void AdjustAllWindowsBoundsForWorkAreaChange(wm::WMEvent event); |
94 | 100 |
95 // Updates the visibility state of the shelf. | 101 // Updates the visibility state of the shelf. |
96 void UpdateShelfVisibility(); | 102 void UpdateShelfVisibility(); |
97 | 103 |
| 104 // Updates the visibility of the backdrop. |
| 105 void UpdateStackingAndVisibilityOfBackdrop(); |
| 106 |
98 // Updates the fullscreen state of the workspace and notifies Shell if it | 107 // Updates the fullscreen state of the workspace and notifies Shell if it |
99 // has changed. | 108 // has changed. |
100 void UpdateFullscreenState(); | 109 void UpdateFullscreenState(); |
101 | 110 |
102 // Updates the bounds of the window for a show type change from | 111 // Updates the bounds of the window for a show type change from |
103 // |old_show_type|. | 112 // |old_show_type|. |
104 void UpdateBoundsFromShowType(wm::WindowState* window_state, | 113 void UpdateBoundsFromShowType(wm::WindowState* window_state, |
105 wm::WindowShowType old_show_type); | 114 wm::WindowShowType old_show_type); |
106 | 115 |
107 // If |window_state| is maximized or fullscreen the bounds of the | 116 // If |window_state| is maximized or fullscreen the bounds of the |
108 // window are set and true is returned. Does nothing otherwise. | 117 // window are set and true is returned. Does nothing otherwise. |
109 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); | 118 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); |
110 | 119 |
111 // Animates the window bounds to |bounds|. | 120 // Animates the window bounds to |bounds|. |
112 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); | 121 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); |
113 | 122 |
114 internal::ShelfLayoutManager* shelf_; | 123 internal::ShelfLayoutManager* shelf_; |
115 aura::Window* window_; | 124 aura::Window* window_; |
116 aura::Window* root_window_; | 125 aura::Window* root_window_; |
117 | 126 |
118 // Set of windows we're listening to. | 127 // Set of windows we're listening to. |
119 WindowSet windows_; | 128 WindowSet windows_; |
120 | 129 |
121 // The work area in the coordinates of |window_|. | 130 // The work area in the coordinates of |window_|. |
122 gfx::Rect work_area_in_parent_; | 131 gfx::Rect work_area_in_parent_; |
123 | 132 |
124 // True if this workspace is currently in fullscreen mode. | 133 // True if this workspace is currently in fullscreen mode. |
125 bool is_fullscreen_; | 134 bool is_fullscreen_; |
126 | 135 |
| 136 // A window which covers the full container and which gets inserted behind the |
| 137 // topmost visible window. |
| 138 scoped_ptr<WorkspaceLayoutManagerBackdrop> backdrop_; |
| 139 |
127 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 140 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
128 }; | 141 }; |
129 | 142 |
130 } // namespace internal | 143 } // namespace internal |
131 } // namespace ash | 144 } // namespace ash |
132 | 145 |
133 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 146 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
OLD | NEW |