| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // this WorkspaceManager. Deleting workspace will automatically | 37 // this WorkspaceManager. Deleting workspace will automatically |
| 38 // remove the workspace from the workspace_manager. | 38 // remove the workspace from the workspace_manager. |
| 39 Workspace* CreateWorkspace(); | 39 Workspace* CreateWorkspace(); |
| 40 | 40 |
| 41 // Returns the active workspace. | 41 // Returns the active workspace. |
| 42 Workspace* GetActiveWorkspace() const; | 42 Workspace* GetActiveWorkspace() const; |
| 43 | 43 |
| 44 // Returns the workspace that contanis the |window|. | 44 // Returns the workspace that contanis the |window|. |
| 45 Workspace* FindBy(aura::Window* window) const; | 45 Workspace* FindBy(aura::Window* window) const; |
| 46 | 46 |
| 47 // Returns the window for rotate operation based on the |location|. |
| 48 aura::Window* FindRotateWindowForLocation(const gfx::Point& location); |
| 49 |
| 47 // Sets the bounds of all workspaces. | 50 // Sets the bounds of all workspaces. |
| 48 void LayoutWorkspaces(); | 51 void LayoutWorkspaces(); |
| 49 | 52 |
| 50 // Returns the bounds in which a window can be moved/resized. | 53 // Returns the bounds in which a window can be moved/resized. |
| 51 gfx::Rect GetDragAreaBounds(); | 54 gfx::Rect GetDragAreaBounds(); |
| 52 | 55 |
| 53 // Turn on/off overview mode. | 56 // Turn on/off overview mode. |
| 54 void SetOverview(bool overview); | 57 void SetOverview(bool overview); |
| 55 bool is_overview() const { return is_overview_; } | 58 bool is_overview() const { return is_overview_; } |
| 56 | 59 |
| 60 // Rotate windows by moving |source| window to the position of |target|. |
| 61 void RotateWindows(aura::Window* source, aura::Window* target); |
| 62 |
| 57 // Overridden from aura::DesktopObserver: | 63 // Overridden from aura::DesktopObserver: |
| 58 virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE; | 64 virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE; |
| 59 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; | 65 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; |
| 60 | 66 |
| 61 private: | 67 private: |
| 62 friend class Workspace; | 68 friend class Workspace; |
| 63 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, Overview); | 69 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, Overview); |
| 64 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, LayoutWorkspaces); | 70 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, LayoutWorkspaces); |
| 71 FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, FindRotateWindow); |
| 65 | 72 |
| 66 void AddWorkspace(Workspace* workspace); | 73 void AddWorkspace(Workspace* workspace); |
| 67 void RemoveWorkspace(Workspace* workspace); | 74 void RemoveWorkspace(Workspace* workspace); |
| 68 | 75 |
| 69 // Sets the active workspace. | 76 // Sets the active workspace. |
| 70 void SetActiveWorkspace(Workspace* workspace); | 77 void SetActiveWorkspace(Workspace* workspace); |
| 71 | 78 |
| 72 // Returns the bounds of the work are given |workspace_bounds|. | 79 // Returns the bounds of the work are given |workspace_bounds|. |
| 73 gfx::Rect GetWorkAreaBounds(const gfx::Rect& workspace_bounds); | 80 gfx::Rect GetWorkAreaBounds(const gfx::Rect& workspace_bounds); |
| 74 | 81 |
| 82 // Returns the index of the workspace that contains the |window|. |
| 83 int GetWorkspaceIndexContaining(aura::Window* window) const; |
| 84 |
| 75 // Update viewport size and move to the active workspace. | 85 // Update viewport size and move to the active workspace. |
| 76 void UpdateViewport(); | 86 void UpdateViewport(); |
| 77 | 87 |
| 78 aura::Window* viewport_; | 88 aura::Window* viewport_; |
| 79 | 89 |
| 80 Workspace* active_workspace_; | 90 Workspace* active_workspace_; |
| 81 | 91 |
| 82 std::vector<Workspace*> workspaces_; | 92 std::vector<Workspace*> workspaces_; |
| 83 | 93 |
| 84 // The size of a single workspace. This is generally the same as the size of | 94 // The size of a single workspace. This is generally the same as the size of |
| 85 // monitor. | 95 // monitor. |
| 86 gfx::Size workspace_size_; | 96 gfx::Size workspace_size_; |
| 87 | 97 |
| 88 // True if the workspace manager is in overview mode. | 98 // True if the workspace manager is in overview mode. |
| 89 bool is_overview_; | 99 bool is_overview_; |
| 90 | 100 |
| 91 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); | 101 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); |
| 92 }; | 102 }; |
| 93 | 103 |
| 94 } // namespace aura_shell | 104 } // namespace aura_shell |
| 95 | 105 |
| 96 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ | 106 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ |
| OLD | NEW |