Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: ui/aura_shell/workspace/workspace_manager.h

Issue 8430024: Add WorkspaceObserver to observe changes in workspace state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_; }
sky 2011/11/02 03:57:49 nit: this actually isn't a viewport. A viewport is
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
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 // LayoutManager for this workspace manager request must not modify
sky 2011/11/02 03:57:49 How about replacing the second sentence with: 'Whe
77 // the requested bounds in |SetChildBounds| when this flag is true.
78 bool layout_in_progress() const nj{ return layout_in_progress_; }
sky 2011/11/02 03:57:49 remove 'nj'
79
80 // Sets the |layout_in_progress_| flag.
81 void set_layout_in_progress(bool layout_in_progress) {
82 layout_in_progress_ = layout_in_progress;
83 }
84
65 private: 85 private:
66 friend class Workspace; 86 friend class Workspace;
67 87
68 void AddWorkspace(Workspace* workspace); 88 void AddWorkspace(Workspace* workspace);
69 void RemoveWorkspace(Workspace* workspace); 89 void RemoveWorkspace(Workspace* workspace);
70 90
71 // Sets the active workspace. 91 // Sets the active workspace.
72 void SetActiveWorkspace(Workspace* workspace); 92 void SetActiveWorkspace(Workspace* workspace);
73 93
74 // Returns the bounds of the work are given |workspace_bounds|. 94 // Returns the bounds of the work are given |workspace_bounds|.
(...skipping 11 matching lines...) Expand all
86 106
87 std::vector<Workspace*> workspaces_; 107 std::vector<Workspace*> workspaces_;
88 108
89 // The size of a single workspace. This is generally the same as the size of 109 // The size of a single workspace. This is generally the same as the size of
90 // monitor. 110 // monitor.
91 gfx::Size workspace_size_; 111 gfx::Size workspace_size_;
92 112
93 // True if the workspace manager is in overview mode. 113 // True if the workspace manager is in overview mode.
94 bool is_overview_; 114 bool is_overview_;
95 115
116 // True if this layout manager is laying out windows.
117 bool layout_in_progress_;
118
119 ObserverList<WorkspaceObserver> observers_;
120
96 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); 121 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager);
97 }; 122 };
98 123
99 } // namespace internal 124 } // namespace internal
100 } // namespace aura_shell 125 } // namespace aura_shell
101 126
102 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_ 127 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698