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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class Workspace; | 46 class Workspace; |
47 | 47 |
48 // WorkspaceManager manages multiple workspaces in the desktop. Workspaces are | 48 // WorkspaceManager manages multiple workspaces in the desktop. Workspaces are |
49 // implicitly created as windows are maximized (or made fullscreen), and | 49 // implicitly created as windows are maximized (or made fullscreen), and |
50 // destroyed when maximized windows are closed or restored. There is always one | 50 // destroyed when maximized windows are closed or restored. There is always one |
51 // workspace for the desktop. | 51 // workspace for the desktop. |
52 // Internally WorkspaceManager creates a Window for each Workspace. As windows | 52 // Internally WorkspaceManager creates a Window for each Workspace. As windows |
53 // are maximized and restored they are reparented to the right Window. | 53 // are maximized and restored they are reparented to the right Window. |
54 class ASH_EXPORT WorkspaceManager : public ash::ShellObserver { | 54 class ASH_EXPORT WorkspaceManager : public ash::ShellObserver { |
55 public: | 55 public: |
| 56 enum CycleDirection { |
| 57 CYCLE_NEXT, |
| 58 CYCLE_PREVIOUS |
| 59 }; |
| 60 |
56 explicit WorkspaceManager(aura::Window* viewport); | 61 explicit WorkspaceManager(aura::Window* viewport); |
57 virtual ~WorkspaceManager(); | 62 virtual ~WorkspaceManager(); |
58 | 63 |
59 // Returns true if |window| is considered maximized and should exist in its | 64 // Returns true if |window| is considered maximized and should exist in its |
60 // own workspace. | 65 // own workspace. |
61 static bool IsMaximized(aura::Window* window); | 66 static bool IsMaximized(aura::Window* window); |
62 static bool IsMaximizedState(ui::WindowShowState state); | 67 static bool IsMaximizedState(ui::WindowShowState state); |
63 | 68 |
64 // Returns true if |window| is minimized and will restore to a maximized | 69 // Returns true if |window| is minimized and will restore to a maximized |
65 // window. | 70 // window. |
66 static bool WillRestoreMaximized(aura::Window* window); | 71 static bool WillRestoreMaximized(aura::Window* window); |
67 | 72 |
68 // Returns the current window state. | 73 // Returns the current window state. |
69 WorkspaceWindowState GetWindowState() const; | 74 WorkspaceWindowState GetWindowState() const; |
70 | 75 |
71 void SetShelf(ShelfLayoutManager* shelf); | 76 void SetShelf(ShelfLayoutManager* shelf); |
72 | 77 |
73 // Activates the workspace containing |window|. Does nothing if |window| is | 78 // Activates the workspace containing |window|. Does nothing if |window| is |
74 // NULL or not contained in a workspace. | 79 // NULL or not contained in a workspace. |
75 void SetActiveWorkspaceByWindow(aura::Window* window); | 80 void SetActiveWorkspaceByWindow(aura::Window* window); |
76 | 81 |
77 // Returns the parent for |window|. This is invoked from StackingController | 82 // Returns the parent for |window|. This is invoked from StackingController |
78 // when a new Window is being added. | 83 // when a new Window is being added. |
79 aura::Window* GetParentForNewWindow(aura::Window* window); | 84 aura::Window* GetParentForNewWindow(aura::Window* window); |
80 | 85 |
| 86 // Called by the workspace cycler to activate the next workspace in |
| 87 // |direction|. Returns false if there are no more workspaces to cycle |
| 88 // to in |direction|. |
| 89 bool CycleToWorkspace(CycleDirection direction); |
| 90 |
81 // Starts the animation that occurs on first login. | 91 // Starts the animation that occurs on first login. |
82 void DoInitialAnimation(); | 92 void DoInitialAnimation(); |
83 | 93 |
84 // ShellObserver overrides: | 94 // ShellObserver overrides: |
85 virtual void OnAppTerminating() OVERRIDE; | 95 virtual void OnAppTerminating() OVERRIDE; |
86 | 96 |
87 private: | 97 private: |
88 friend class WorkspaceLayoutManager; | 98 friend class WorkspaceLayoutManager; |
89 friend class WorkspaceManagerTest; | 99 friend class WorkspaceManagerTest; |
90 | 100 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // DesktopBackgroundFadeController. | 260 // DesktopBackgroundFadeController. |
251 bool creating_fade_; | 261 bool creating_fade_; |
252 | 262 |
253 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 263 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
254 }; | 264 }; |
255 | 265 |
256 } // namespace internal | 266 } // namespace internal |
257 } // namespace ash | 267 } // namespace ash |
258 | 268 |
259 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ | 269 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
OLD | NEW |