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_MANAGER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
6 #define ASH_WM_WORKSPACE_MANAGER_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/wm/workspace/base_workspace_manager.h" |
11 #include "ash/wm/workspace/workspace.h" | 12 #include "ash/wm/workspace/workspace.h" |
12 #include "ash/wm/workspace/workspace_types.h" | 13 #include "ash/wm/workspace/workspace_types.h" |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "ui/gfx/insets.h" | 16 #include "ui/gfx/insets.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 class Window; | 20 class Window; |
20 } | 21 } |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class Point; | 24 class Point; |
24 class Rect; | 25 class Rect; |
25 } | 26 } |
26 | 27 |
27 namespace ash { | 28 namespace ash { |
28 namespace internal { | 29 namespace internal { |
29 | 30 |
30 class ShelfLayoutManager; | 31 class ShelfLayoutManager; |
31 class WorkspaceManagerTest; | 32 class WorkspaceManagerTest; |
32 | 33 |
33 // WorkspaceManager manages multiple workspaces in the desktop. | 34 // WorkspaceManager manages multiple workspaces in the desktop. |
34 class ASH_EXPORT WorkspaceManager { | 35 class ASH_EXPORT WorkspaceManager : public BaseWorkspaceManager { |
35 public: | 36 public: |
36 explicit WorkspaceManager(aura::Window* viewport); | 37 explicit WorkspaceManager(aura::Window* viewport); |
37 virtual ~WorkspaceManager(); | 38 virtual ~WorkspaceManager(); |
38 | 39 |
39 // Returns true if |window| should be managed by the WorkspaceManager. Use | 40 // Returns true if |window| should be managed by the WorkspaceManager. Use |
40 // Contains() to test if the Window is currently managed by WorkspaceManager. | 41 // Contains() to test if the Window is currently managed by WorkspaceManager. |
41 static bool ShouldManageWindow(aura::Window* window); | 42 static bool ShouldManageWindow(aura::Window* window); |
42 | 43 |
43 // Returns true if |window| has been added to this WorkspaceManager. | 44 // Returns true if |window| has been added to this WorkspaceManager. |
44 bool Contains(aura::Window* window) const; | 45 bool Contains(aura::Window* window) const; |
45 | 46 |
46 // Returns true if in maximized or fullscreen mode. | |
47 bool IsInMaximizedMode() const; | |
48 | |
49 // Adds/removes a window creating/destroying workspace as necessary. | 47 // Adds/removes a window creating/destroying workspace as necessary. |
50 void AddWindow(aura::Window* window); | 48 void AddWindow(aura::Window* window); |
51 void RemoveWindow(aura::Window* window); | 49 void RemoveWindow(aura::Window* window); |
52 | 50 |
53 // Activates the workspace containing |window|. Does nothing if |window| is | |
54 // NULL or not contained in a workspace. | |
55 void SetActiveWorkspaceByWindow(aura::Window* window); | |
56 | |
57 // Returns the Window this WorkspaceManager controls. | 51 // Returns the Window this WorkspaceManager controls. |
58 aura::Window* contents_view() { return contents_view_; } | 52 aura::Window* contents_view() { return contents_view_; } |
59 | 53 |
60 // Returns the window for rotate operation based on the |location|. | |
61 // TODO: this isn't currently used; remove if we do away with overview. | |
62 aura::Window* FindRotateWindowForLocation(const gfx::Point& location); | |
63 | |
64 // Returns the bounds in which a window can be moved/resized. | |
65 gfx::Rect GetDragAreaBounds(); | |
66 | |
67 // Sets the size of the grid. Newly added windows are forced to align to the | |
68 // size of the grid. | |
69 void SetGridSize(int grid_size); | |
70 int grid_size() const { return grid_size_; } | |
71 | |
72 void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; } | |
73 | |
74 // Updates the visibility and whether any windows overlap the shelf. | 54 // Updates the visibility and whether any windows overlap the shelf. |
75 void UpdateShelfVisibility(); | 55 void UpdateShelfVisibility(); |
76 | 56 |
77 // Returns the current window state. | |
78 WorkspaceWindowState GetWindowState() const; | |
79 | |
80 // Invoked when the show state of the specified window changes. | 57 // Invoked when the show state of the specified window changes. |
81 void ShowStateChanged(aura::Window* window); | 58 void ShowStateChanged(aura::Window* window); |
82 | 59 |
| 60 // BaseWorkspaceManager overrides: |
| 61 virtual bool IsInMaximizedMode() const OVERRIDE; |
| 62 virtual void SetGridSize(int size) OVERRIDE; |
| 63 virtual int GetGridSize() const OVERRIDE; |
| 64 virtual WorkspaceWindowState GetWindowState() const OVERRIDE; |
| 65 virtual void SetShelf(ShelfLayoutManager* shelf) OVERRIDE; |
| 66 virtual void SetActiveWorkspaceByWindow(aura::Window* window) OVERRIDE; |
| 67 virtual aura::Window* GetParentForNewWindow(aura::Window* window) OVERRIDE; |
| 68 |
83 private: | 69 private: |
84 // Enumeration of whether windows should animate or not. | 70 // Enumeration of whether windows should animate or not. |
85 enum AnimateChangeType { | 71 enum AnimateChangeType { |
86 ANIMATE, | 72 ANIMATE, |
87 DONT_ANIMATE | 73 DONT_ANIMATE |
88 }; | 74 }; |
89 | 75 |
90 friend class Workspace; | 76 friend class Workspace; |
91 friend class WorkspaceManagerTest; | 77 friend class WorkspaceManagerTest; |
92 | 78 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 136 |
151 // Owned by the Shell container window LauncherContainer. May be NULL. | 137 // Owned by the Shell container window LauncherContainer. May be NULL. |
152 ShelfLayoutManager* shelf_; | 138 ShelfLayoutManager* shelf_; |
153 | 139 |
154 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 140 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
155 }; | 141 }; |
156 | 142 |
157 } // namespace internal | 143 } // namespace internal |
158 } // namespace ash | 144 } // namespace ash |
159 | 145 |
160 #endif // ASH_WM_WORKSPACE_MANAGER_H_ | 146 #endif // ASH_WM_WORKSPACE_WORKSPACE_MANAGER_H_ |
OLD | NEW |