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_MANAGER2_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ |
6 #define ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 namespace ui { | 31 namespace ui { |
32 class Layer; | 32 class Layer; |
33 } | 33 } |
34 | 34 |
35 namespace ash { | 35 namespace ash { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 class ShelfLayoutManager; | 38 class ShelfLayoutManager; |
39 class SystemBackgroundController; | |
40 class WorkspaceLayoutManager2; | 39 class WorkspaceLayoutManager2; |
41 class WorkspaceManagerTest2; | 40 class WorkspaceManagerTest2; |
42 class Workspace2; | 41 class Workspace2; |
43 | 42 |
44 // WorkspaceManager manages multiple workspaces in the desktop. Workspaces are | 43 // WorkspaceManager manages multiple workspaces in the desktop. Workspaces are |
45 // implicitly created as windows are maximized (or made fullscreen), and | 44 // implicitly created as windows are maximized (or made fullscreen), and |
46 // destroyed when maximized windows are closed or restored. There is always one | 45 // destroyed when maximized windows are closed or restored. There is always one |
47 // workspace for the desktop. | 46 // workspace for the desktop. |
48 // Internally WorkspaceManager2 creates a Window for each Workspace. As windows | 47 // Internally WorkspaceManager2 creates a Window for each Workspace. As windows |
49 // are maximized and restored they are reparented to the right Window. | 48 // are maximized and restored they are reparented to the right Window. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void SelectNextWorkspace(AnimateType animate_type); | 131 void SelectNextWorkspace(AnimateType animate_type); |
133 | 132 |
134 // Schedules |workspace| for deletion when it no longer contains any layers. | 133 // Schedules |workspace| for deletion when it no longer contains any layers. |
135 // See comments above |to_delete_| as to why we do this. | 134 // See comments above |to_delete_| as to why we do this. |
136 void ScheduleDelete(Workspace2* workspace); | 135 void ScheduleDelete(Workspace2* workspace); |
137 | 136 |
138 // Deletes any workspaces scheduled via ScheduleDelete() that don't contain | 137 // Deletes any workspaces scheduled via ScheduleDelete() that don't contain |
139 // any layers. | 138 // any layers. |
140 void ProcessDeletion(); | 139 void ProcessDeletion(); |
141 | 140 |
142 // Deletes |background_controller_|. Called from |destroy_background_timer_|. | |
143 void DestroySystemBackground(); | |
144 | |
145 // Sets |unminimizing_workspace_| to |workspace|. | 141 // Sets |unminimizing_workspace_| to |workspace|. |
146 void SetUnminimizingWorkspace(Workspace2* workspace); | 142 void SetUnminimizingWorkspace(Workspace2* workspace); |
147 | 143 |
148 // These methods are forwarded from the LayoutManager installed on the | 144 // These methods are forwarded from the LayoutManager installed on the |
149 // Workspace's window. | 145 // Workspace's window. |
150 void OnWindowAddedToWorkspace(Workspace2* workspace, aura::Window* child); | 146 void OnWindowAddedToWorkspace(Workspace2* workspace, aura::Window* child); |
151 void OnWillRemoveWindowFromWorkspace(Workspace2* workspace, | 147 void OnWillRemoveWindowFromWorkspace(Workspace2* workspace, |
152 aura::Window* child); | 148 aura::Window* child); |
153 void OnWindowRemovedFromWorkspace(Workspace2* workspace, aura::Window* child); | 149 void OnWindowRemovedFromWorkspace(Workspace2* workspace, aura::Window* child); |
154 void OnWorkspaceChildWindowVisibilityChanged(Workspace2* workspace, | 150 void OnWorkspaceChildWindowVisibilityChanged(Workspace2* workspace, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Ideally we would delete workspaces when not needed. Unfortunately doing so | 187 // Ideally we would delete workspaces when not needed. Unfortunately doing so |
192 // would effectively cancel animations. Instead when a workspace is no longer | 188 // would effectively cancel animations. Instead when a workspace is no longer |
193 // needed we add it here and start a timer. When the timer fires any windows | 189 // needed we add it here and start a timer. When the timer fires any windows |
194 // no longer contain layers are deleted. | 190 // no longer contain layers are deleted. |
195 std::set<Workspace2*> to_delete_; | 191 std::set<Workspace2*> to_delete_; |
196 base::OneShotTimer<WorkspaceManager2> delete_timer_; | 192 base::OneShotTimer<WorkspaceManager2> delete_timer_; |
197 | 193 |
198 // See comments in SetUnminimizingWorkspace() for details. | 194 // See comments in SetUnminimizingWorkspace() for details. |
199 base::WeakPtrFactory<WorkspaceManager2> clear_unminimizing_workspace_factory_; | 195 base::WeakPtrFactory<WorkspaceManager2> clear_unminimizing_workspace_factory_; |
200 | 196 |
201 // Used to show the system level background. Non-null when the background is | |
202 // visible. | |
203 scoped_ptr<SystemBackgroundController> background_controller_; | |
204 | |
205 // Timer used to destroy the background. We wait to destroy until animations | |
206 // complete. | |
207 base::OneShotTimer<WorkspaceManager2> destroy_background_timer_; | |
208 | |
209 // See comments in SetUnminimizingWorkspace() for details. | 197 // See comments in SetUnminimizingWorkspace() for details. |
210 Workspace2* unminimizing_workspace_; | 198 Workspace2* unminimizing_workspace_; |
211 | 199 |
212 // Set to true if the app is terminating. If true we don't animate the | 200 // Set to true if the app is terminating. If true we don't animate the |
213 // background, otherwise it can get stuck in the fading position when chrome | 201 // background, otherwise it can get stuck in the fading position when chrome |
214 // exits (as the last frame we draw before exiting is a frame from the | 202 // exits (as the last frame we draw before exiting is a frame from the |
215 // animation). | 203 // animation). |
216 bool app_terminating_; | 204 bool app_terminating_; |
217 | 205 |
218 // If non-empty this is the amount of time animating the desktop in/out. | 206 // If non-empty this is the amount of time animating the desktop in/out. |
219 base::TimeDelta switch_duration_; | 207 base::TimeDelta switch_duration_; |
220 | 208 |
221 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager2); | 209 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager2); |
222 }; | 210 }; |
223 | 211 |
224 } // namespace internal | 212 } // namespace internal |
225 } // namespace ash | 213 } // namespace ash |
226 | 214 |
227 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ | 215 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ |
OLD | NEW |