| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void SelectNextWorkspace(AnimateType animate_type); | 127 void SelectNextWorkspace(AnimateType animate_type); |
| 129 | 128 |
| 130 // Schedules |workspace| for deletion when it no longer contains any layers. | 129 // Schedules |workspace| for deletion when it no longer contains any layers. |
| 131 // See comments above |to_delete_| as to why we do this. | 130 // See comments above |to_delete_| as to why we do this. |
| 132 void ScheduleDelete(Workspace2* workspace); | 131 void ScheduleDelete(Workspace2* workspace); |
| 133 | 132 |
| 134 // Deletes any workspaces scheduled via ScheduleDelete() that don't contain | 133 // Deletes any workspaces scheduled via ScheduleDelete() that don't contain |
| 135 // any layers. | 134 // any layers. |
| 136 void ProcessDeletion(); | 135 void ProcessDeletion(); |
| 137 | 136 |
| 138 // Deletes |background_controller_|. Called from |destroy_background_timer_|. | |
| 139 void DestroySystemBackground(); | |
| 140 | |
| 141 // Sets |unminimizing_workspace_| to |workspace|. | 137 // Sets |unminimizing_workspace_| to |workspace|. |
| 142 void SetUnminimizingWorkspace(Workspace2* workspace); | 138 void SetUnminimizingWorkspace(Workspace2* workspace); |
| 143 | 139 |
| 144 // These methods are forwarded from the LayoutManager installed on the | 140 // These methods are forwarded from the LayoutManager installed on the |
| 145 // Workspace's window. | 141 // Workspace's window. |
| 146 void OnWindowAddedToWorkspace(Workspace2* workspace, aura::Window* child); | 142 void OnWindowAddedToWorkspace(Workspace2* workspace, aura::Window* child); |
| 147 void OnWillRemoveWindowFromWorkspace(Workspace2* workspace, | 143 void OnWillRemoveWindowFromWorkspace(Workspace2* workspace, |
| 148 aura::Window* child); | 144 aura::Window* child); |
| 149 void OnWindowRemovedFromWorkspace(Workspace2* workspace, aura::Window* child); | 145 void OnWindowRemovedFromWorkspace(Workspace2* workspace, aura::Window* child); |
| 150 void OnWorkspaceChildWindowVisibilityChanged(Workspace2* workspace, | 146 void OnWorkspaceChildWindowVisibilityChanged(Workspace2* workspace, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Ideally we would delete workspaces when not needed. Unfortunately doing so | 183 // Ideally we would delete workspaces when not needed. Unfortunately doing so |
| 188 // would effectively cancel animations. Instead when a workspace is no longer | 184 // would effectively cancel animations. Instead when a workspace is no longer |
| 189 // needed we add it here and start a timer. When the timer fires any windows | 185 // needed we add it here and start a timer. When the timer fires any windows |
| 190 // no longer contain layers are deleted. | 186 // no longer contain layers are deleted. |
| 191 std::set<Workspace2*> to_delete_; | 187 std::set<Workspace2*> to_delete_; |
| 192 base::OneShotTimer<WorkspaceManager2> delete_timer_; | 188 base::OneShotTimer<WorkspaceManager2> delete_timer_; |
| 193 | 189 |
| 194 // See comments in SetUnminimizingWorkspace() for details. | 190 // See comments in SetUnminimizingWorkspace() for details. |
| 195 base::WeakPtrFactory<WorkspaceManager2> clear_unminimizing_workspace_factory_; | 191 base::WeakPtrFactory<WorkspaceManager2> clear_unminimizing_workspace_factory_; |
| 196 | 192 |
| 197 // Used to show the system level background. Non-null when the background is | |
| 198 // visible. | |
| 199 scoped_ptr<SystemBackgroundController> background_controller_; | |
| 200 | |
| 201 // Timer used to destroy the background. We wait to destroy until animations | |
| 202 // complete. | |
| 203 base::OneShotTimer<WorkspaceManager2> destroy_background_timer_; | |
| 204 | |
| 205 // See comments in SetUnminimizingWorkspace() for details. | 193 // See comments in SetUnminimizingWorkspace() for details. |
| 206 Workspace2* unminimizing_workspace_; | 194 Workspace2* unminimizing_workspace_; |
| 207 | 195 |
| 208 // Set to true if the app is terminating. If true we don't animate the | 196 // Set to true if the app is terminating. If true we don't animate the |
| 209 // background, otherwise it can get stuck in the fading position when chrome | 197 // background, otherwise it can get stuck in the fading position when chrome |
| 210 // exits (as the last frame we draw before exiting is a frame from the | 198 // exits (as the last frame we draw before exiting is a frame from the |
| 211 // animation). | 199 // animation). |
| 212 bool app_terminating_; | 200 bool app_terminating_; |
| 213 | 201 |
| 214 // If non-empty this is the amount of time animating the desktop in/out. | 202 // If non-empty this is the amount of time animating the desktop in/out. |
| 215 base::TimeDelta switch_duration_; | 203 base::TimeDelta switch_duration_; |
| 216 | 204 |
| 217 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager2); | 205 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager2); |
| 218 }; | 206 }; |
| 219 | 207 |
| 220 } // namespace internal | 208 } // namespace internal |
| 221 } // namespace ash | 209 } // namespace ash |
| 222 | 210 |
| 223 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ | 211 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER2_H_ |
| OLD | NEW |