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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 11293014: Renames Workspace*2 -> Workspace*. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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) 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 #include "ash/wm/workspace/workspace_layout_manager2.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/always_on_top_controller.h" 10 #include "ash/wm/always_on_top_controller.h"
11 #include "ash/wm/base_layout_manager.h" 11 #include "ash/wm/base_layout_manager.h"
12 #include "ash/wm/window_animations.h" 12 #include "ash/wm/window_animations.h"
13 #include "ash/wm/window_properties.h" 13 #include "ash/wm/window_properties.h"
14 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
15 #include "ash/wm/workspace/workspace2.h" 15 #include "ash/wm/workspace/workspace.h"
16 #include "ash/wm/workspace/workspace_manager2.h" 16 #include "ash/wm/workspace/workspace_manager.h"
17 #include "ash/wm/workspace/workspace_window_resizer.h" 17 #include "ash/wm/workspace/workspace_window_resizer.h"
18 #include "base/auto_reset.h" 18 #include "base/auto_reset.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/root_window.h" 21 #include "ui/aura/root_window.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/aura/window_observer.h" 23 #include "ui/aura/window_observer.h"
24 #include "ui/base/events/event.h" 24 #include "ui/base/events/event.h"
25 #include "ui/base/ui_base_types.h" 25 #include "ui/base/ui_base_types.h"
26 26
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 BoundsMap::const_iterator i = bounds_map.find(window); 63 BoundsMap::const_iterator i = bounds_map.find(window);
64 if (i != bounds_map.end()) 64 if (i != bounds_map.end())
65 window->SetBounds(i->second); 65 window->SetBounds(i->second);
66 } 66 }
67 for (size_t i = 0; i < window->children().size(); ++i) 67 for (size_t i = 0; i < window->children().size(); ++i)
68 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window->children()[i]); 68 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window->children()[i]);
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 WorkspaceLayoutManager2::WorkspaceLayoutManager2(Workspace2* workspace) 73 WorkspaceLayoutManager::WorkspaceLayoutManager(Workspace* workspace)
74 : root_window_(workspace->window()->GetRootWindow()), 74 : root_window_(workspace->window()->GetRootWindow()),
75 workspace_(workspace), 75 workspace_(workspace),
76 work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent( 76 work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
77 workspace->window()->parent())) { 77 workspace->window()->parent())) {
78 Shell::GetInstance()->AddShellObserver(this); 78 Shell::GetInstance()->AddShellObserver(this);
79 root_window_->AddRootWindowObserver(this); 79 root_window_->AddRootWindowObserver(this);
80 root_window_->AddObserver(this); 80 root_window_->AddObserver(this);
81 } 81 }
82 82
83 WorkspaceLayoutManager2::~WorkspaceLayoutManager2() { 83 WorkspaceLayoutManager::~WorkspaceLayoutManager() {
84 if (root_window_) { 84 if (root_window_) {
85 root_window_->RemoveObserver(this); 85 root_window_->RemoveObserver(this);
86 root_window_->RemoveRootWindowObserver(this); 86 root_window_->RemoveRootWindowObserver(this);
87 } 87 }
88 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) 88 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
89 (*i)->RemoveObserver(this); 89 (*i)->RemoveObserver(this);
90 Shell::GetInstance()->RemoveShellObserver(this); 90 Shell::GetInstance()->RemoveShellObserver(this);
91 } 91 }
92 92
93 void WorkspaceLayoutManager2::OnWindowAddedToLayout(Window* child) { 93 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) {
94 // Adjust window bounds in case that the new child is out of the workspace. 94 // Adjust window bounds in case that the new child is out of the workspace.
95 AdjustWindowSizeForScreenChange(child, ADJUST_WINDOW_DISPLAY_INSETS_CHANGED); 95 AdjustWindowSizeForScreenChange(child, ADJUST_WINDOW_DISPLAY_INSETS_CHANGED);
96 96
97 windows_.insert(child); 97 windows_.insert(child);
98 child->AddObserver(this); 98 child->AddObserver(this);
99 99
100 // Only update the bounds if the window has a show state that depends on the 100 // Only update the bounds if the window has a show state that depends on the
101 // workspace area. 101 // workspace area.
102 if (wm::IsWindowMaximized(child) || wm::IsWindowFullscreen(child)) 102 if (wm::IsWindowMaximized(child) || wm::IsWindowFullscreen(child))
103 UpdateBoundsFromShowState(child); 103 UpdateBoundsFromShowState(child);
104 104
105 workspace_manager()->OnWindowAddedToWorkspace(workspace_, child); 105 workspace_manager()->OnWindowAddedToWorkspace(workspace_, child);
106 } 106 }
107 107
108 void WorkspaceLayoutManager2::OnWillRemoveWindowFromLayout(Window* child) { 108 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) {
109 windows_.erase(child); 109 windows_.erase(child);
110 child->RemoveObserver(this); 110 child->RemoveObserver(this);
111 workspace_manager()->OnWillRemoveWindowFromWorkspace(workspace_, child); 111 workspace_manager()->OnWillRemoveWindowFromWorkspace(workspace_, child);
112 } 112 }
113 113
114 void WorkspaceLayoutManager2::OnWindowRemovedFromLayout(Window* child) { 114 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) {
115 workspace_manager()->OnWindowRemovedFromWorkspace(workspace_, child); 115 workspace_manager()->OnWindowRemovedFromWorkspace(workspace_, child);
116 } 116 }
117 117
118 void WorkspaceLayoutManager2::OnChildWindowVisibilityChanged(Window* child, 118 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child,
119 bool visible) { 119 bool visible) {
120 if (visible && wm::IsWindowMinimized(child)) { 120 if (visible && wm::IsWindowMinimized(child)) {
121 // Attempting to show a minimized window. Unminimize it. 121 // Attempting to show a minimized window. Unminimize it.
122 child->SetProperty(aura::client::kShowStateKey, 122 child->SetProperty(aura::client::kShowStateKey,
123 child->GetProperty(internal::kRestoreShowStateKey)); 123 child->GetProperty(internal::kRestoreShowStateKey));
124 child->ClearProperty(internal::kRestoreShowStateKey); 124 child->ClearProperty(internal::kRestoreShowStateKey);
125 } 125 }
126 workspace_manager()->OnWorkspaceChildWindowVisibilityChanged(workspace_, 126 workspace_manager()->OnWorkspaceChildWindowVisibilityChanged(workspace_,
127 child); 127 child);
128 } 128 }
129 129
130 void WorkspaceLayoutManager2::SetChildBounds( 130 void WorkspaceLayoutManager::SetChildBounds(
131 Window* child, 131 Window* child,
132 const gfx::Rect& requested_bounds) { 132 const gfx::Rect& requested_bounds) {
133 if (!GetTrackedByWorkspace(child)) { 133 if (!GetTrackedByWorkspace(child)) {
134 SetChildBoundsDirect(child, requested_bounds); 134 SetChildBoundsDirect(child, requested_bounds);
135 return; 135 return;
136 } 136 }
137 gfx::Rect child_bounds(requested_bounds); 137 gfx::Rect child_bounds(requested_bounds);
138 // Some windows rely on this to set their initial bounds. 138 // Some windows rely on this to set their initial bounds.
139 if (!SetMaximizedOrFullscreenBounds(child)) { 139 if (!SetMaximizedOrFullscreenBounds(child)) {
140 // Non-maximized/full-screen windows have their size constrained to the 140 // Non-maximized/full-screen windows have their size constrained to the
141 // work-area. 141 // work-area.
142 child_bounds.set_width(std::min(work_area_.width(), child_bounds.width())); 142 child_bounds.set_width(std::min(work_area_.width(), child_bounds.width()));
143 child_bounds.set_height( 143 child_bounds.set_height(
144 std::min(work_area_.height(), child_bounds.height())); 144 std::min(work_area_.height(), child_bounds.height()));
145 SetChildBoundsDirect(child, child_bounds); 145 SetChildBoundsDirect(child, child_bounds);
146 } 146 }
147 workspace_manager()->OnWorkspaceWindowChildBoundsChanged(workspace_, child); 147 workspace_manager()->OnWorkspaceWindowChildBoundsChanged(workspace_, child);
148 } 148 }
149 149
150 void WorkspaceLayoutManager2::OnRootWindowResized(const aura::RootWindow* root, 150 void WorkspaceLayoutManager::OnRootWindowResized(const aura::RootWindow* root,
151 const gfx::Size& old_size) { 151 const gfx::Size& old_size) {
152 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_SCREEN_SIZE_CHANGED); 152 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_SCREEN_SIZE_CHANGED);
153 } 153 }
154 154
155 void WorkspaceLayoutManager2::OnDisplayWorkAreaInsetsChanged() { 155 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() {
156 if (workspace_manager()->active_workspace_ == workspace_) { 156 if (workspace_manager()->active_workspace_ == workspace_) {
157 const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent( 157 const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
158 workspace_->window()->parent())); 158 workspace_->window()->parent()));
159 if (work_area != work_area_) 159 if (work_area != work_area_)
160 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_DISPLAY_INSETS_CHANGED); 160 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_DISPLAY_INSETS_CHANGED);
161 } 161 }
162 } 162 }
163 163
164 void WorkspaceLayoutManager2::OnWindowPropertyChanged(Window* window, 164 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
165 const void* key, 165 const void* key,
166 intptr_t old) { 166 intptr_t old) {
167 if (key == aura::client::kShowStateKey) { 167 if (key == aura::client::kShowStateKey) {
168 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old); 168 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old);
169 ui::WindowShowState new_state = 169 ui::WindowShowState new_state =
170 window->GetProperty(aura::client::kShowStateKey); 170 window->GetProperty(aura::client::kShowStateKey);
171 if (old_state != ui::SHOW_STATE_MINIMIZED && 171 if (old_state != ui::SHOW_STATE_MINIMIZED &&
172 GetRestoreBoundsInScreen(window) == NULL && 172 GetRestoreBoundsInScreen(window) == NULL &&
173 WorkspaceManager2::IsMaximizedState(new_state) && 173 WorkspaceManager::IsMaximizedState(new_state) &&
174 !WorkspaceManager2::IsMaximizedState(old_state)) { 174 !WorkspaceManager::IsMaximizedState(old_state)) {
175 SetRestoreBoundsInParent(window, window->bounds()); 175 SetRestoreBoundsInParent(window, window->bounds());
176 } 176 }
177 // When restoring from a minimized state, we want to restore to the 177 // When restoring from a minimized state, we want to restore to the
178 // previous (maybe L/R maximized) state. Since we do also want to keep the 178 // previous (maybe L/R maximized) state. Since we do also want to keep the
179 // restore rectangle, we set the restore rectangle to the rectangle we want 179 // restore rectangle, we set the restore rectangle to the rectangle we want
180 // to restore to and restore it after we switched so that it is preserved. 180 // to restore to and restore it after we switched so that it is preserved.
181 gfx::Rect restore; 181 gfx::Rect restore;
182 if (old_state == ui::SHOW_STATE_MINIMIZED && 182 if (old_state == ui::SHOW_STATE_MINIMIZED &&
183 (new_state == ui::SHOW_STATE_NORMAL || 183 (new_state == ui::SHOW_STATE_NORMAL ||
184 new_state == ui::SHOW_STATE_DEFAULT) && 184 new_state == ui::SHOW_STATE_DEFAULT) &&
185 GetRestoreBoundsInScreen(window)) { 185 GetRestoreBoundsInScreen(window)) {
186 restore = *GetRestoreBoundsInScreen(window); 186 restore = *GetRestoreBoundsInScreen(window);
187 SetRestoreBoundsInScreen(window, window->bounds()); 187 SetRestoreBoundsInScreen(window, window->bounds());
188 } 188 }
189 189
190 // If maximizing or restoring, clone the layer. WorkspaceManager will use it 190 // If maximizing or restoring, clone the layer. WorkspaceManager will use it
191 // (and take ownership of it) when animating. Ideally we could use that of 191 // (and take ownership of it) when animating. Ideally we could use that of
192 // BaseLayoutManager, but that proves problematic. In particular when 192 // BaseLayoutManager, but that proves problematic. In particular when
193 // restoring we need to animate on top of the workspace animating in. 193 // restoring we need to animate on top of the workspace animating in.
194 ui::Layer* cloned_layer = NULL; 194 ui::Layer* cloned_layer = NULL;
195 BoundsMap bounds_map; 195 BoundsMap bounds_map;
196 if (wm::IsActiveWindow(window) && 196 if (wm::IsActiveWindow(window) &&
197 ((WorkspaceManager2::IsMaximizedState(new_state) && 197 ((WorkspaceManager::IsMaximizedState(new_state) &&
198 wm::IsWindowStateNormal(old_state)) || 198 wm::IsWindowStateNormal(old_state)) ||
199 (!WorkspaceManager2::IsMaximizedState(new_state) && 199 (!WorkspaceManager::IsMaximizedState(new_state) &&
200 WorkspaceManager2::IsMaximizedState(old_state) && 200 WorkspaceManager::IsMaximizedState(old_state) &&
201 new_state != ui::SHOW_STATE_MINIMIZED))) { 201 new_state != ui::SHOW_STATE_MINIMIZED))) {
202 BuildWindowBoundsMap(window, &bounds_map); 202 BuildWindowBoundsMap(window, &bounds_map);
203 cloned_layer = wm::RecreateWindowLayers(window, false); 203 cloned_layer = wm::RecreateWindowLayers(window, false);
204 // Constrained windows don't get their bounds reset when we update the 204 // Constrained windows don't get their bounds reset when we update the
205 // window bounds. Leaving them empty is unexpected, so we reset them now. 205 // window bounds. Leaving them empty is unexpected, so we reset them now.
206 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window); 206 ResetConstrainedWindowBoundsIfNecessary(bounds_map, window);
207 } 207 }
208 UpdateBoundsFromShowState(window); 208 UpdateBoundsFromShowState(window);
209 209
210 if (cloned_layer) { 210 if (cloned_layer) {
(...skipping 18 matching lines...) Expand all
229 229
230 if (key == aura::client::kAlwaysOnTopKey && 230 if (key == aura::client::kAlwaysOnTopKey &&
231 window->GetProperty(aura::client::kAlwaysOnTopKey)) { 231 window->GetProperty(aura::client::kAlwaysOnTopKey)) {
232 internal::AlwaysOnTopController* controller = 232 internal::AlwaysOnTopController* controller =
233 window->GetRootWindow()->GetProperty( 233 window->GetRootWindow()->GetProperty(
234 internal::kAlwaysOnTopControllerKey); 234 internal::kAlwaysOnTopControllerKey);
235 controller->GetContainer(window)->AddChild(window); 235 controller->GetContainer(window)->AddChild(window);
236 } 236 }
237 } 237 }
238 238
239 void WorkspaceLayoutManager2::OnWindowDestroying(aura::Window* window) { 239 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {
240 if (root_window_ == window) { 240 if (root_window_ == window) {
241 root_window_->RemoveObserver(this); 241 root_window_->RemoveObserver(this);
242 root_window_ = NULL; 242 root_window_ = NULL;
243 } 243 }
244 } 244 }
245 245
246 void WorkspaceLayoutManager2::ShowStateChanged( 246 void WorkspaceLayoutManager::ShowStateChanged(
247 Window* window, 247 Window* window,
248 ui::WindowShowState last_show_state, 248 ui::WindowShowState last_show_state,
249 ui::Layer* cloned_layer) { 249 ui::Layer* cloned_layer) {
250 if (wm::IsWindowMinimized(window)) { 250 if (wm::IsWindowMinimized(window)) {
251 DCHECK(!cloned_layer); 251 DCHECK(!cloned_layer);
252 // Save the previous show state so that we can correctly restore it. 252 // Save the previous show state so that we can correctly restore it.
253 window->SetProperty(internal::kRestoreShowStateKey, last_show_state); 253 window->SetProperty(internal::kRestoreShowStateKey, last_show_state);
254 SetWindowVisibilityAnimationType( 254 SetWindowVisibilityAnimationType(
255 window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); 255 window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
256 workspace_manager()->OnWorkspaceWindowShowStateChanged( 256 workspace_manager()->OnWorkspaceWindowShowStateChanged(
257 workspace_, window, last_show_state, NULL); 257 workspace_, window, last_show_state, NULL);
258 window->Hide(); 258 window->Hide();
259 if (wm::IsActiveWindow(window)) 259 if (wm::IsActiveWindow(window))
260 wm::DeactivateWindow(window); 260 wm::DeactivateWindow(window);
261 } else { 261 } else {
262 if ((window->TargetVisibility() || 262 if ((window->TargetVisibility() ||
263 last_show_state == ui::SHOW_STATE_MINIMIZED) && 263 last_show_state == ui::SHOW_STATE_MINIMIZED) &&
264 !window->layer()->visible()) { 264 !window->layer()->visible()) {
265 // The layer may be hidden if the window was previously minimized. Make 265 // The layer may be hidden if the window was previously minimized. Make
266 // sure it's visible. 266 // sure it's visible.
267 window->Show(); 267 window->Show();
268 } 268 }
269 workspace_manager()->OnWorkspaceWindowShowStateChanged( 269 workspace_manager()->OnWorkspaceWindowShowStateChanged(
270 workspace_, window, last_show_state, cloned_layer); 270 workspace_, window, last_show_state, cloned_layer);
271 } 271 }
272 } 272 }
273 273
274 void WorkspaceLayoutManager2::AdjustWindowSizesForScreenChange( 274 void WorkspaceLayoutManager::AdjustWindowSizesForScreenChange(
275 AdjustWindowReason reason) { 275 AdjustWindowReason reason) {
276 work_area_ = ScreenAsh::GetDisplayWorkAreaBoundsInParent( 276 work_area_ = ScreenAsh::GetDisplayWorkAreaBoundsInParent(
277 workspace_->window()->parent()); 277 workspace_->window()->parent());
278 // If a user plugs an external display into a laptop running Aura the 278 // If a user plugs an external display into a laptop running Aura the
279 // display size will change. Maximized windows need to resize to match. 279 // display size will change. Maximized windows need to resize to match.
280 // We also do this when developers running Aura on a desktop manually resize 280 // We also do this when developers running Aura on a desktop manually resize
281 // the host window. 281 // the host window.
282 // We also need to do this when the work area insets changes. 282 // We also need to do this when the work area insets changes.
283 for (WindowSet::const_iterator it = windows_.begin(); 283 for (WindowSet::const_iterator it = windows_.begin();
284 it != windows_.end(); 284 it != windows_.end();
285 ++it) { 285 ++it) {
286 AdjustWindowSizeForScreenChange(*it, reason); 286 AdjustWindowSizeForScreenChange(*it, reason);
287 } 287 }
288 } 288 }
289 289
290 void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange( 290 void WorkspaceLayoutManager::AdjustWindowSizeForScreenChange(
291 Window* window, 291 Window* window,
292 AdjustWindowReason reason) { 292 AdjustWindowReason reason) {
293 if (GetTrackedByWorkspace(window) && 293 if (GetTrackedByWorkspace(window) &&
294 !SetMaximizedOrFullscreenBounds(window)) { 294 !SetMaximizedOrFullscreenBounds(window)) {
295 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) { 295 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) {
296 // The work area may be smaller than the full screen. Put as much of the 296 // The work area may be smaller than the full screen. Put as much of the
297 // window as possible within the display area. 297 // window as possible within the display area.
298 gfx::Rect bounds = window->bounds(); 298 gfx::Rect bounds = window->bounds();
299 bounds.AdjustToFit(work_area_); 299 bounds.AdjustToFit(work_area_);
300 window->SetBounds(bounds); 300 window->SetBounds(bounds);
(...skipping 18 matching lines...) Expand all
319 x_offset = work_area_.x() - bounds.right() + kMinimumOnScreenArea; 319 x_offset = work_area_.x() - bounds.right() + kMinimumOnScreenArea;
320 } 320 }
321 bounds.Offset(x_offset, y_offset); 321 bounds.Offset(x_offset, y_offset);
322 } 322 }
323 if (window->bounds() != bounds) 323 if (window->bounds() != bounds)
324 window->SetBounds(bounds); 324 window->SetBounds(bounds);
325 } 325 }
326 } 326 }
327 } 327 }
328 328
329 void WorkspaceLayoutManager2::UpdateBoundsFromShowState(Window* window) { 329 void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) {
330 // See comment in SetMaximizedOrFullscreenBounds() as to why we use parent in 330 // See comment in SetMaximizedOrFullscreenBounds() as to why we use parent in
331 // these calculation. 331 // these calculation.
332 switch (window->GetProperty(aura::client::kShowStateKey)) { 332 switch (window->GetProperty(aura::client::kShowStateKey)) {
333 case ui::SHOW_STATE_DEFAULT: 333 case ui::SHOW_STATE_DEFAULT:
334 case ui::SHOW_STATE_NORMAL: { 334 case ui::SHOW_STATE_NORMAL: {
335 const gfx::Rect* restore = GetRestoreBoundsInScreen(window); 335 const gfx::Rect* restore = GetRestoreBoundsInScreen(window);
336 if (restore) { 336 if (restore) {
337 gfx::Rect bounds_in_parent = 337 gfx::Rect bounds_in_parent =
338 ScreenAsh::ConvertRectFromScreen(window->parent()->parent(), 338 ScreenAsh::ConvertRectFromScreen(window->parent()->parent(),
339 *restore); 339 *restore);
(...skipping 10 matching lines...) Expand all
350 case ui::SHOW_STATE_MAXIMIZED: 350 case ui::SHOW_STATE_MAXIMIZED:
351 case ui::SHOW_STATE_FULLSCREEN: 351 case ui::SHOW_STATE_FULLSCREEN:
352 SetMaximizedOrFullscreenBounds(window); 352 SetMaximizedOrFullscreenBounds(window);
353 break; 353 break;
354 354
355 default: 355 default:
356 break; 356 break;
357 } 357 }
358 } 358 }
359 359
360 bool WorkspaceLayoutManager2::SetMaximizedOrFullscreenBounds( 360 bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds(
361 aura::Window* window) { 361 aura::Window* window) {
362 if (!GetTrackedByWorkspace(window)) 362 if (!GetTrackedByWorkspace(window))
363 return false; 363 return false;
364 364
365 // During animations there is a transform installed on the workspace 365 // During animations there is a transform installed on the workspace
366 // windows. For this reason this code uses the parent so that the transform is 366 // windows. For this reason this code uses the parent so that the transform is
367 // ignored. 367 // ignored.
368 if (wm::IsWindowMaximized(window)) { 368 if (wm::IsWindowMaximized(window)) {
369 SetChildBoundsDirect( 369 SetChildBoundsDirect(
370 window, ScreenAsh::GetMaximizedWindowBoundsInParent( 370 window, ScreenAsh::GetMaximizedWindowBoundsInParent(
371 window->parent()->parent())); 371 window->parent()->parent()));
372 return true; 372 return true;
373 } 373 }
374 if (wm::IsWindowFullscreen(window)) { 374 if (wm::IsWindowFullscreen(window)) {
375 SetChildBoundsDirect( 375 SetChildBoundsDirect(
376 window, 376 window,
377 ScreenAsh::GetDisplayBoundsInParent(window->parent()->parent())); 377 ScreenAsh::GetDisplayBoundsInParent(window->parent()->parent()));
378 return true; 378 return true;
379 } 379 }
380 return false; 380 return false;
381 } 381 }
382 382
383 WorkspaceManager2* WorkspaceLayoutManager2::workspace_manager() { 383 WorkspaceManager* WorkspaceLayoutManager::workspace_manager() {
384 return workspace_->workspace_manager(); 384 return workspace_->workspace_manager();
385 } 385 }
386 386
387 } // namespace internal 387 } // namespace internal
388 } // namespace ash 388 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_layout_manager2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698