| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ | 5 #ifndef UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ |
| 6 #define UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ | 6 #define UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/observer_list.h" |
| 12 #include "ui/aura_shell/aura_shell_export.h" | 13 #include "ui/aura_shell/aura_shell_export.h" |
| 13 #include "ui/gfx/insets.h" | 14 #include "ui/gfx/insets.h" |
| 14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 15 | 16 |
| 16 namespace aura { | 17 namespace aura { |
| 17 class Window; | 18 class Window; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gfx { | 21 namespace gfx { |
| 21 class Point; | 22 class Point; |
| 22 class Rect; | 23 class Rect; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace aura_shell { | 26 namespace aura_shell { |
| 26 namespace internal { | 27 namespace internal { |
| 27 class Workspace; | 28 class Workspace; |
| 29 class WorkspaceObserver; |
| 28 | 30 |
| 29 // WorkspaceManager manages multiple workspaces in the desktop. | 31 // WorkspaceManager manages multiple workspaces in the desktop. |
| 30 class AURA_SHELL_EXPORT WorkspaceManager { | 32 class AURA_SHELL_EXPORT WorkspaceManager { |
| 31 public: | 33 public: |
| 32 explicit WorkspaceManager(aura::Window* viewport); | 34 explicit WorkspaceManager(aura::Window* viewport); |
| 33 virtual ~WorkspaceManager(); | 35 virtual ~WorkspaceManager(); |
| 34 | 36 |
| 37 // Returns the viewport window this WorkspaceManager layouts |
| 38 // workspaces on. |
| 39 aura::Window* viewport() { return viewport_; } |
| 40 |
| 35 // Create new workspace. Workspace objects are managed by | 41 // Create new workspace. Workspace objects are managed by |
| 36 // this WorkspaceManager. Deleting workspace will automatically | 42 // this WorkspaceManager. Deleting workspace will automatically |
| 37 // remove the workspace from the workspace_manager. | 43 // remove the workspace from the workspace_manager. |
| 38 Workspace* CreateWorkspace(); | 44 Workspace* CreateWorkspace(); |
| 39 | 45 |
| 40 // Returns the active workspace. | 46 // Returns the active workspace. |
| 41 Workspace* GetActiveWorkspace() const; | 47 Workspace* GetActiveWorkspace() const; |
| 42 | 48 |
| 43 // Returns the workspace that contanis the |window|. | 49 // Returns the workspace that contanis the |window|. |
| 44 Workspace* FindBy(aura::Window* window) const; | 50 Workspace* FindBy(aura::Window* window) const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 // Turn on/off overview mode. | 61 // Turn on/off overview mode. |
| 56 void SetOverview(bool overview); | 62 void SetOverview(bool overview); |
| 57 bool is_overview() const { return is_overview_; } | 63 bool is_overview() const { return is_overview_; } |
| 58 | 64 |
| 59 // Rotate windows by moving |source| window to the position of |target|. | 65 // Rotate windows by moving |source| window to the position of |target|. |
| 60 void RotateWindows(aura::Window* source, aura::Window* target); | 66 void RotateWindows(aura::Window* source, aura::Window* target); |
| 61 | 67 |
| 62 // Sets the size of a single workspace (all workspaces have the same size). | 68 // Sets the size of a single workspace (all workspaces have the same size). |
| 63 void SetWorkspaceSize(const gfx::Size& workspace_size); | 69 void SetWorkspaceSize(const gfx::Size& workspace_size); |
| 64 | 70 |
| 71 // Adds/Removes workspace observer. |
| 72 void AddObserver(WorkspaceObserver* observer); |
| 73 void RemoveObserver(WorkspaceObserver* observer); |
| 74 |
| 75 // Returns true if this workspace manager is laying out windows. |
| 76 // When true, LayoutManager must give windows their requested bounds. |
| 77 bool layout_in_progress() const { return layout_in_progress_; } |
| 78 |
| 79 // Sets the |layout_in_progress_| flag. |
| 80 void set_layout_in_progress(bool layout_in_progress) { |
| 81 layout_in_progress_ = layout_in_progress; |
| 82 } |
| 83 |
| 65 private: | 84 private: |
| 66 friend class Workspace; | 85 friend class Workspace; |
| 67 | 86 |
| 68 void AddWorkspace(Workspace* workspace); | 87 void AddWorkspace(Workspace* workspace); |
| 69 void RemoveWorkspace(Workspace* workspace); | 88 void RemoveWorkspace(Workspace* workspace); |
| 70 | 89 |
| 71 // Sets the active workspace. | 90 // Sets the active workspace. |
| 72 void SetActiveWorkspace(Workspace* workspace); | 91 void SetActiveWorkspace(Workspace* workspace); |
| 73 | 92 |
| 74 // Returns the bounds of the work are given |workspace_bounds|. | 93 // Returns the bounds of the work are given |workspace_bounds|. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 | 105 |
| 87 std::vector<Workspace*> workspaces_; | 106 std::vector<Workspace*> workspaces_; |
| 88 | 107 |
| 89 // The size of a single workspace. This is generally the same as the size of | 108 // The size of a single workspace. This is generally the same as the size of |
| 90 // monitor. | 109 // monitor. |
| 91 gfx::Size workspace_size_; | 110 gfx::Size workspace_size_; |
| 92 | 111 |
| 93 // True if the workspace manager is in overview mode. | 112 // True if the workspace manager is in overview mode. |
| 94 bool is_overview_; | 113 bool is_overview_; |
| 95 | 114 |
| 115 // True if this layout manager is laying out windows. |
| 116 bool layout_in_progress_; |
| 117 |
| 118 ObserverList<WorkspaceObserver> observers_; |
| 119 |
| 96 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 120 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
| 97 }; | 121 }; |
| 98 | 122 |
| 99 } // namespace internal | 123 } // namespace internal |
| 100 } // namespace aura_shell | 124 } // namespace aura_shell |
| 101 | 125 |
| 102 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ | 126 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ |
| OLD | NEW |