| 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/gtest_prod_util.h" | |
| 13 #include "ui/aura/desktop_observer.h" | |
| 14 #include "ui/aura_shell/aura_shell_export.h" | 12 #include "ui/aura_shell/aura_shell_export.h" |
| 15 #include "ui/gfx/insets.h" | 13 #include "ui/gfx/insets.h" |
| 16 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 17 | 15 |
| 18 namespace aura { | 16 namespace aura { |
| 19 class Window; | 17 class Window; |
| 20 } | 18 } |
| 21 | 19 |
| 22 namespace gfx { | 20 namespace gfx { |
| 23 class Point; | 21 class Point; |
| 24 class Rect; | 22 class Rect; |
| 25 } | 23 } |
| 26 | 24 |
| 27 namespace aura_shell { | 25 namespace aura_shell { |
| 26 namespace internal { |
| 28 class Workspace; | 27 class Workspace; |
| 29 | 28 |
| 30 // WorkspaceManager manages multiple workspaces in the desktop. | 29 // WorkspaceManager manages multiple workspaces in the desktop. |
| 31 class AURA_SHELL_EXPORT WorkspaceManager : public aura::DesktopObserver { | 30 class AURA_SHELL_EXPORT WorkspaceManager { |
| 32 public: | 31 public: |
| 33 explicit WorkspaceManager(aura::Window* viewport); | 32 explicit WorkspaceManager(aura::Window* viewport); |
| 34 virtual ~WorkspaceManager(); | 33 virtual ~WorkspaceManager(); |
| 35 | 34 |
| 36 // Create new workspace. Workspace objects are managed by | 35 // Create new workspace. Workspace objects are managed by |
| 37 // this WorkspaceManager. Deleting workspace will automatically | 36 // this WorkspaceManager. Deleting workspace will automatically |
| 38 // remove the workspace from the workspace_manager. | 37 // remove the workspace from the workspace_manager. |
| 39 Workspace* CreateWorkspace(); | 38 Workspace* CreateWorkspace(); |
| 40 | 39 |
| 41 // Returns the active workspace. | 40 // Returns the active workspace. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 53 // Returns the bounds in which a window can be moved/resized. | 52 // Returns the bounds in which a window can be moved/resized. |
| 54 gfx::Rect GetDragAreaBounds(); | 53 gfx::Rect GetDragAreaBounds(); |
| 55 | 54 |
| 56 // Turn on/off overview mode. | 55 // Turn on/off overview mode. |
| 57 void SetOverview(bool overview); | 56 void SetOverview(bool overview); |
| 58 bool is_overview() const { return is_overview_; } | 57 bool is_overview() const { return is_overview_; } |
| 59 | 58 |
| 60 // Rotate windows by moving |source| window to the position of |target|. | 59 // Rotate windows by moving |source| window to the position of |target|. |
| 61 void RotateWindows(aura::Window* source, aura::Window* target); | 60 void RotateWindows(aura::Window* source, aura::Window* target); |
| 62 | 61 |
| 63 // Overridden from aura::DesktopObserver: | 62 // Sets the size of a single workspace (all workspaces have the same size). |
| 64 virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE; | 63 void SetWorkspaceSize(const gfx::Size& workspace_size); |
| 65 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; | |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 friend class Workspace; | 66 friend class Workspace; |
| 69 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, Overview); | |
| 70 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, LayoutWorkspaces); | |
| 71 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, FindRotateWindow); | |
| 72 | 67 |
| 73 void AddWorkspace(Workspace* workspace); | 68 void AddWorkspace(Workspace* workspace); |
| 74 void RemoveWorkspace(Workspace* workspace); | 69 void RemoveWorkspace(Workspace* workspace); |
| 75 | 70 |
| 76 // Sets the active workspace. | 71 // Sets the active workspace. |
| 77 void SetActiveWorkspace(Workspace* workspace); | 72 void SetActiveWorkspace(Workspace* workspace); |
| 78 | 73 |
| 79 // Returns the bounds of the work are given |workspace_bounds|. | 74 // Returns the bounds of the work are given |workspace_bounds|. |
| 80 gfx::Rect GetWorkAreaBounds(const gfx::Rect& workspace_bounds); | 75 gfx::Rect GetWorkAreaBounds(const gfx::Rect& workspace_bounds); |
| 81 | 76 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 // The size of a single workspace. This is generally the same as the size of | 89 // The size of a single workspace. This is generally the same as the size of |
| 95 // monitor. | 90 // monitor. |
| 96 gfx::Size workspace_size_; | 91 gfx::Size workspace_size_; |
| 97 | 92 |
| 98 // True if the workspace manager is in overview mode. | 93 // True if the workspace manager is in overview mode. |
| 99 bool is_overview_; | 94 bool is_overview_; |
| 100 | 95 |
| 101 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 96 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
| 102 }; | 97 }; |
| 103 | 98 |
| 99 } // namespace internal |
| 104 } // namespace aura_shell | 100 } // namespace aura_shell |
| 105 | 101 |
| 106 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ | 102 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ |
| OLD | NEW |