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

Side by Side Diff: ash/wm/workspace/workspace_manager.h

Issue 9764008: Makes the launcher auto-hide for maximized windows. This turned out to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add null checks and cleanup Created 8 years, 9 months 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) 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_MANAGER_H_
6 #define ASH_WM_WORKSPACE_MANAGER_H_ 6 #define ASH_WM_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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // TODO: this isn't currently used; remove if we do away with overview. 56 // TODO: this isn't currently used; remove if we do away with overview.
57 aura::Window* FindRotateWindowForLocation(const gfx::Point& location); 57 aura::Window* FindRotateWindowForLocation(const gfx::Point& location);
58 58
59 // Returns the bounds in which a window can be moved/resized. 59 // Returns the bounds in which a window can be moved/resized.
60 gfx::Rect GetDragAreaBounds(); 60 gfx::Rect GetDragAreaBounds();
61 61
62 // Turn on/off overview mode. 62 // Turn on/off overview mode.
63 void SetOverview(bool overview); 63 void SetOverview(bool overview);
64 bool is_overview() const { return is_overview_; } 64 bool is_overview() const { return is_overview_; }
65 65
66 // Sets the size of a single workspace (all workspaces have the same size).
67 void SetWorkspaceSize(const gfx::Size& workspace_size);
68
69 // Called when monitor's work area insets changes.
70 void OnMonitorWorkAreaInsetsChanged();
71
72 // Returns the window the layout manager should allow the size to be set for. 66 // Returns the window the layout manager should allow the size to be set for.
73 // TODO: maybe this should be set on WorkspaceLayoutManager. 67 // TODO: maybe this should be set on WorkspaceLayoutManager.
74 aura::Window* ignored_window() { return ignored_window_; } 68 aura::Window* ignored_window() { return ignored_window_; }
75 69
76 // Sets the size of the grid. Newly added windows are forced to align to the 70 // Sets the size of the grid. Newly added windows are forced to align to the
77 // size of the grid. 71 // size of the grid.
78 void set_grid_size(int size) { grid_size_ = size; } 72 void set_grid_size(int size) { grid_size_ = size; }
79 int grid_size() const { return grid_size_; } 73 int grid_size() const { return grid_size_; }
80 74
81 // Returns a bounds aligned to the grid. Returns |bounds| if grid_size is 0. 75 // Returns a bounds aligned to the grid. Returns |bounds| if grid_size is 0.
82 gfx::Rect AlignBoundsToGrid(const gfx::Rect& bounds); 76 gfx::Rect AlignBoundsToGrid(const gfx::Rect& bounds);
83 77
84 void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; } 78 void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; }
85 79
80 // Updates the visibility and whether any windows overlap the shelf.
81 void UpdateShelfVisibility();
82
86 // Invoked when the show state of the specified window changes. 83 // Invoked when the show state of the specified window changes.
87 void ShowStateChanged(aura::Window* window); 84 void ShowStateChanged(aura::Window* window);
88 85
89 private: 86 private:
90 // Enumeration of whether windows should animate or not. 87 // Enumeration of whether windows should animate or not.
91 enum AnimateChangeType { 88 enum AnimateChangeType {
92 ANIMATE, 89 ANIMATE,
93 DONT_ANIMATE 90 DONT_ANIMATE
94 }; 91 };
95 92
96 friend class Workspace; 93 friend class Workspace;
97 friend class WorkspaceManagerTest; 94 friend class WorkspaceManagerTest;
98 95
99 // See description above getter. 96 // See description above getter.
100 void set_ignored_window(aura::Window* ignored_window) { 97 void set_ignored_window(aura::Window* ignored_window) {
101 ignored_window_ = ignored_window; 98 ignored_window_ = ignored_window;
102 } 99 }
103 100
104 void AddWorkspace(Workspace* workspace); 101 void AddWorkspace(Workspace* workspace);
105 void RemoveWorkspace(Workspace* workspace); 102 void RemoveWorkspace(Workspace* workspace);
106 103
107 void UpdateShelfVisibility();
108
109 // Sets the visibility of the windows in |workspace|. 104 // Sets the visibility of the windows in |workspace|.
110 void SetVisibilityOfWorkspaceWindows(Workspace* workspace, 105 void SetVisibilityOfWorkspaceWindows(Workspace* workspace,
111 AnimateChangeType change_type, 106 AnimateChangeType change_type,
112 bool value); 107 bool value);
113 108
114 // Implementation of SetVisibilityOfWorkspaceWindows(). 109 // Implementation of SetVisibilityOfWorkspaceWindows().
115 void SetWindowLayerVisibility(const std::vector<aura::Window*>& windows, 110 void SetWindowLayerVisibility(const std::vector<aura::Window*>& windows,
116 AnimateChangeType change_type, 111 AnimateChangeType change_type,
117 bool value); 112 bool value);
118 113
119 // Returns the active workspace. 114 // Returns the active workspace.
120 Workspace* GetActiveWorkspace() const; 115 Workspace* GetActiveWorkspace() const;
121 116
122 // Returns the workspace that contanis the |window|. 117 // Returns the workspace that contanis the |window|.
123 Workspace* FindBy(aura::Window* window) const; 118 Workspace* FindBy(aura::Window* window) const;
124 119
125 // Sets the active workspace. 120 // Sets the active workspace.
126 void SetActiveWorkspace(Workspace* workspace); 121 void SetActiveWorkspace(Workspace* workspace);
127 122
128 // Returns the bounds of the work area. 123 // Returns the bounds of the work area.
129 gfx::Rect GetWorkAreaBounds() const; 124 gfx::Rect GetWorkAreaBounds() const;
130 125
131 // Returns the index of the workspace that contains the |window|. 126 // Returns the index of the workspace that contains the |window|.
132 int GetWorkspaceIndexContaining(aura::Window* window) const; 127 int GetWorkspaceIndexContaining(aura::Window* window) const;
133 128
134 // Sets the bounds of |window|. This sets |ignored_window_| to |window| so 129 // Sets the bounds of |window|. This sets |ignored_window_| to |window| so
135 // that the bounds change is allowed through. 130 // that the bounds change is allowed through.
136 void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds); 131 void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds);
137 132
138 // Sets the bounds of all workspaces.
139 void SetWorkspaceBounds();
140
141 // Invoked when the type of workspace needed for |window| changes. 133 // Invoked when the type of workspace needed for |window| changes.
142 void OnTypeOfWorkspacedNeededChanged(aura::Window* window); 134 void OnTypeOfWorkspacedNeededChanged(aura::Window* window);
143 135
144 // Returns the Workspace whose type is TYPE_MANAGED, or NULL if there isn't 136 // Returns the Workspace whose type is TYPE_MANAGED, or NULL if there isn't
145 // one. 137 // one.
146 Workspace* GetManagedWorkspace(); 138 Workspace* GetManagedWorkspace();
147 139
148 // Creates a new workspace of the specified type. 140 // Creates a new workspace of the specified type.
149 Workspace* CreateWorkspace(Workspace::Type type); 141 Workspace* CreateWorkspace(Workspace::Type type);
150 142
151 // Deletes workspaces of TYPE_MAXIMIZED when they become empty. 143 // Deletes workspaces of TYPE_MAXIMIZED when they become empty.
152 void CleanupWorkspace(Workspace* workspace); 144 void CleanupWorkspace(Workspace* workspace);
153 145
154 aura::Window* contents_view_; 146 aura::Window* contents_view_;
155 147
156 Workspace* active_workspace_; 148 Workspace* active_workspace_;
157 149
158 std::vector<Workspace*> workspaces_; 150 std::vector<Workspace*> workspaces_;
159 151
160 // The size of a single workspace. This is generally the same as the size of
161 // monitor.
162 gfx::Size workspace_size_;
163
164 // True if the workspace manager is in overview mode. 152 // True if the workspace manager is in overview mode.
165 bool is_overview_; 153 bool is_overview_;
166 154
167 // The window that WorkspaceManager does not set the bounds on. 155 // The window that WorkspaceManager does not set the bounds on.
168 aura::Window* ignored_window_; 156 aura::Window* ignored_window_;
169 157
170 // See description above setter. 158 // See description above setter.
171 int grid_size_; 159 int grid_size_;
172 160
173 // Owned by the Shell container window LauncherContainer. May be NULL. 161 // Owned by the Shell container window LauncherContainer. May be NULL.
174 ShelfLayoutManager* shelf_; 162 ShelfLayoutManager* shelf_;
175 163
176 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager); 164 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager);
177 }; 165 };
178 166
179 } // namespace internal 167 } // namespace internal
180 } // namespace ash 168 } // namespace ash
181 169
182 #endif // ASH_WM_WORKSPACE_MANAGER_H_ 170 #endif // ASH_WM_WORKSPACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698