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_MANAGER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
6 #define ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 void SetShelf(ShelfLayoutManager* shelf); | 71 void SetShelf(ShelfLayoutManager* shelf); |
72 | 72 |
73 // Activates the workspace containing |window|. Does nothing if |window| is | 73 // Activates the workspace containing |window|. Does nothing if |window| is |
74 // NULL or not contained in a workspace. | 74 // NULL or not contained in a workspace. |
75 void SetActiveWorkspaceByWindow(aura::Window* window); | 75 void SetActiveWorkspaceByWindow(aura::Window* window); |
76 | 76 |
77 // Returns the parent for |window|. This is invoked from StackingController | 77 // Returns the parent for |window|. This is invoked from StackingController |
78 // when a new Window is being added. | 78 // when a new Window is being added. |
79 aura::Window* GetParentForNewWindow(aura::Window* window); | 79 aura::Window* GetParentForNewWindow(aura::Window* window); |
80 | 80 |
81 // Called by the workspace cycler to hide the currently active workspace. | |
82 // The currently active workspace is moved to |hidden_workspaces_|. | |
83 // Returns false if there are no workspaces which can be hidden. This will be | |
84 // the case if the desktop workspace is currently active. | |
85 bool CycleAwayFromCurrentlyActiveWorkspace(); | |
sadrul
2012/11/23 20:02:07
Where does it cycle to?
| |
86 | |
87 // Called by the workspace cycler to activate the workspace in | |
88 // |hidden_workspaces_| which was most recently added. Activating the | |
89 // workspace moves it to |workspaces_|. | |
90 // Returns false if |hidden_workspaces| is empty. | |
91 bool CycleToNextHiddenWorkspace(); | |
92 | |
81 // Starts the animation that occurs on first login. | 93 // Starts the animation that occurs on first login. |
82 void DoInitialAnimation(); | 94 void DoInitialAnimation(); |
83 | 95 |
96 // Returns the window of the currently active workspace. | |
97 aura::Window* GetActiveWorkspaceWindow() const; | |
98 | |
84 // ShellObserver overrides: | 99 // ShellObserver overrides: |
85 virtual void OnAppTerminating() OVERRIDE; | 100 virtual void OnAppTerminating() OVERRIDE; |
86 | 101 |
87 private: | 102 private: |
88 friend class WorkspaceLayoutManager; | 103 friend class WorkspaceLayoutManager; |
89 friend class WorkspaceManagerTest; | 104 friend class WorkspaceManagerTest; |
90 | 105 |
91 class LayoutManagerImpl; | 106 class LayoutManagerImpl; |
92 | 107 |
93 typedef std::vector<Workspace*> Workspaces; | 108 typedef std::vector<Workspace*> Workspaces; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 145 |
131 Workspace* desktop_workspace() { return workspaces_[0]; } | 146 Workspace* desktop_workspace() { return workspaces_[0]; } |
132 const Workspace* desktop_workspace() const { return workspaces_[0]; } | 147 const Workspace* desktop_workspace() const { return workspaces_[0]; } |
133 | 148 |
134 // Creates a new workspace. The Workspace is not added to anything and is | 149 // Creates a new workspace. The Workspace is not added to anything and is |
135 // owned by the caller. | 150 // owned by the caller. |
136 Workspace* CreateWorkspace(bool maximized); | 151 Workspace* CreateWorkspace(bool maximized); |
137 | 152 |
138 // Moves all the non-maximized child windows of |workspace| to the desktop | 153 // Moves all the non-maximized child windows of |workspace| to the desktop |
139 // stacked beneath |stack_beneath| (if non-NULL). After moving child windows | 154 // stacked beneath |stack_beneath| (if non-NULL). After moving child windows |
140 // if |workspace| contains no children it is deleted, otherwise it it moved to | 155 // if |workspace| contains no children it is deleted. Otherwise, it is moved |
141 // |pending_workspaces_|. | 156 // to |hidden_workspaces_|. |
142 void MoveWorkspaceToPendingOrDelete(Workspace* workspace, | 157 void MoveWorkspaceToHiddenOrDelete(Workspace* workspace, |
143 aura::Window* stack_beneath, | 158 aura::Window* stack_beneath, |
144 SwitchReason reason); | 159 SwitchReason reason); |
145 | 160 |
146 // Moves the children of |window| to the desktop. This excludes certain | 161 // Moves the children of |window| to the desktop. This excludes certain |
147 // windows. If |stack_beneath| is non-NULL the windows are stacked beneath it. | 162 // windows. If |stack_beneath| is non-NULL the windows are stacked beneath it. |
148 void MoveChildrenToDesktop(aura::Window* window, aura::Window* stack_beneath); | 163 void MoveChildrenToDesktop(aura::Window* window, aura::Window* stack_beneath); |
149 | 164 |
150 // Selects the next workspace. | 165 // Selects the next workspace. |
151 void SelectNextWorkspace(SwitchReason reason); | 166 void SelectNextWorkspace(SwitchReason reason); |
152 | 167 |
153 // Schedules |workspace| for deletion when it no longer contains any layers. | 168 // Schedules |workspace| for deletion when it no longer contains any layers. |
154 // See comments above |to_delete_| as to why we do this. | 169 // See comments above |to_delete_| as to why we do this. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 aura::Window* window); | 215 aura::Window* window); |
201 | 216 |
202 aura::Window* contents_view_; | 217 aura::Window* contents_view_; |
203 | 218 |
204 Workspace* active_workspace_; | 219 Workspace* active_workspace_; |
205 | 220 |
206 // The set of active workspaces. There is always at least one in this stack, | 221 // The set of active workspaces. There is always at least one in this stack, |
207 // which identifies the desktop. | 222 // which identifies the desktop. |
208 Workspaces workspaces_; | 223 Workspaces workspaces_; |
209 | 224 |
210 // The set of workspaces not currently active. Workspaces ended up here in | 225 // List of inactive workspaces which were deactivated as a result of a user |
211 // two scenarios: | 226 // action. Workspaces are moved here from |workspaces_| when the workspace's |
212 // . Prior to adding a window a new worskpace is created for it. The | 227 // maximized window is minimized or hidden. The workspace is moved back to |
213 // Workspace is added to this set. | 228 // |workspaces_| when one of its windows is activated. |
214 // . When the maximized window is minimized the workspace is added here. | 229 Workspaces hidden_workspaces_; |
230 | |
231 // Set of workspaces that have never been activated. Workspaces for new | |
232 // windows prior to those windows being activated are added to this set. | |
215 // Once any window in the workspace is activated the workspace is moved to | 233 // Once any window in the workspace is activated the workspace is moved to |
216 // |workspaces_|. | 234 // |workspaces_|. |
217 std::set<Workspace*> pending_workspaces_; | 235 std::set<Workspace*> pending_workspaces_; |
218 | 236 |
219 // Owned by the Shell. May be NULL. | 237 // Owned by the Shell. May be NULL. |
220 ShelfLayoutManager* shelf_; | 238 ShelfLayoutManager* shelf_; |
221 | 239 |
222 // Whether or not we're in MoveWorkspaceToPendingOrDelete(). As | 240 // Whether or not we're in MoveWorkspaceToHiddenOrDelete(). As |
223 // MoveWorkspaceToPendingOrDelete() may trigger another call to | 241 // MoveWorkspaceToHiddenOrDelete() may trigger another call to |
224 // MoveWorkspaceToPendingOrDelete() we use this to avoid doing anything if | 242 // MoveWorkspaceToHiddenOrDelete() we use this to avoid doing anything if |
225 // already in MoveWorkspaceToPendingOrDelete(). | 243 // already in MoveWorkspaceToHiddenOrDelete(). |
226 bool in_move_; | 244 bool in_move_; |
227 | 245 |
228 // Ideally we would delete workspaces when not needed. Unfortunately doing so | 246 // Ideally we would delete workspaces when not needed. Unfortunately doing so |
229 // would effectively cancel animations. Instead when a workspace is no longer | 247 // would effectively cancel animations. Instead when a workspace is no longer |
230 // needed we add it here and start a timer. When the timer fires any windows | 248 // needed we add it here and start a timer. When the timer fires any windows |
231 // no longer contain layers are deleted. | 249 // no longer contain layers are deleted. |
232 std::set<Workspace*> to_delete_; | 250 std::set<Workspace*> to_delete_; |
233 base::OneShotTimer<WorkspaceManager> delete_timer_; | 251 base::OneShotTimer<WorkspaceManager> delete_timer_; |
234 | 252 |
235 // See comments in SetUnminimizingWorkspace() for details. | 253 // See comments in SetUnminimizingWorkspace() for details. |
(...skipping 14 matching lines...) Expand all Loading... | |
250 // DesktopBackgroundFadeController. | 268 // DesktopBackgroundFadeController. |
251 bool creating_fade_; | 269 bool creating_fade_; |
252 | 270 |
253 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 271 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
254 }; | 272 }; |
255 | 273 |
256 } // namespace internal | 274 } // namespace internal |
257 } // namespace ash | 275 } // namespace ash |
258 | 276 |
259 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ | 277 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
OLD | NEW |