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

Side by Side Diff: ash/common/wm/default_state.cc

Issue 2589793002: ash: Should use GetTargetBounds to check call of SetBoundsDirectAnimated (Closed)
Patch Set: nits Created 4 years 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
« no previous file with comments | « no previous file | ash/common/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/wm/default_state.h" 5 #include "ash/common/wm/default_state.h"
6 6
7 #include "ash/common/wm/dock/docked_window_layout_manager.h" 7 #include "ash/common/wm/dock/docked_window_layout_manager.h"
8 #include "ash/common/wm/window_animation_types.h" 8 #include "ash/common/wm/window_animation_types.h"
9 #include "ash/common/wm/window_parenting_utils.h" 9 #include "ash/common/wm/window_parenting_utils.h"
10 #include "ash/common/wm/window_positioning_utils.h" 10 #include "ash/common/wm/window_positioning_utils.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 window_state->SetBoundsConstrained(bounds); 444 window_state->SetBoundsConstrained(bounds);
445 return true; 445 return true;
446 } 446 }
447 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: { 447 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: {
448 if (window_state->is_dragged() || 448 if (window_state->is_dragged() ||
449 SetMaximizedOrFullscreenBounds(window_state)) { 449 SetMaximizedOrFullscreenBounds(window_state)) {
450 return true; 450 return true;
451 } 451 }
452 gfx::Rect work_area_in_parent = 452 gfx::Rect work_area_in_parent =
453 GetDisplayWorkAreaBoundsInParent(window_state->window()); 453 GetDisplayWorkAreaBoundsInParent(window_state->window());
454 gfx::Rect bounds = window_state->window()->GetBounds(); 454 gfx::Rect bounds = window_state->window()->GetTargetBounds();
455 // When display bounds has changed, make sure the entire window is fully 455 // When display bounds has changed, make sure the entire window is fully
456 // visible. 456 // visible.
457 bounds.AdjustToFit(work_area_in_parent); 457 bounds.AdjustToFit(work_area_in_parent);
458 window_state->AdjustSnappedBounds(&bounds); 458 window_state->AdjustSnappedBounds(&bounds);
459 if (window_state->window()->GetBounds() != bounds) 459 if (window_state->window()->GetTargetBounds() != bounds)
460 window_state->SetBoundsDirectAnimated(bounds); 460 window_state->SetBoundsDirectAnimated(bounds);
461 return true; 461 return true;
462 } 462 }
463 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: { 463 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: {
464 // Don't resize the maximized window when the desktop is covered 464 // Don't resize the maximized window when the desktop is covered
465 // by fullscreen window. crbug.com/504299. 465 // by fullscreen window. crbug.com/504299.
466 bool in_fullscreen = 466 bool in_fullscreen =
467 window_state->window() 467 window_state->window()
468 ->GetRootWindowController() 468 ->GetRootWindowController()
469 ->GetWorkspaceWindowState() == WORKSPACE_WINDOW_STATE_FULL_SCREEN; 469 ->GetWorkspaceWindowState() == WORKSPACE_WINDOW_STATE_FULL_SCREEN;
470 if (in_fullscreen && window_state->IsMaximized()) 470 if (in_fullscreen && window_state->IsMaximized())
471 return true; 471 return true;
472 472
473 if (window_state->is_dragged() || 473 if (window_state->is_dragged() ||
474 SetMaximizedOrFullscreenBounds(window_state)) { 474 SetMaximizedOrFullscreenBounds(window_state)) {
475 return true; 475 return true;
476 } 476 }
477 gfx::Rect work_area_in_parent = 477 gfx::Rect work_area_in_parent =
478 GetDisplayWorkAreaBoundsInParent(window_state->window()); 478 GetDisplayWorkAreaBoundsInParent(window_state->window());
479 gfx::Rect bounds = window_state->window()->GetBounds(); 479 gfx::Rect bounds = window_state->window()->GetTargetBounds();
480 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, 480 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent,
481 &bounds); 481 &bounds);
482 window_state->AdjustSnappedBounds(&bounds); 482 window_state->AdjustSnappedBounds(&bounds);
483 if (window_state->window()->GetBounds() != bounds) 483 if (window_state->window()->GetTargetBounds() != bounds)
484 window_state->SetBoundsDirectAnimated(bounds); 484 window_state->SetBoundsDirectAnimated(bounds);
485 return true; 485 return true;
486 } 486 }
487 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: 487 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
488 case WM_EVENT_TOGGLE_MAXIMIZE: 488 case WM_EVENT_TOGGLE_MAXIMIZE:
489 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: 489 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
490 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: 490 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
491 case WM_EVENT_TOGGLE_FULLSCREEN: 491 case WM_EVENT_TOGGLE_FULLSCREEN:
492 case WM_EVENT_CYCLE_SNAP_DOCK_LEFT: 492 case WM_EVENT_CYCLE_SNAP_DOCK_LEFT:
493 case WM_EVENT_CYCLE_SNAP_DOCK_RIGHT: 493 case WM_EVENT_CYCLE_SNAP_DOCK_RIGHT:
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
769 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 769 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
770 window_state->SetBoundsDirectAnimated(center_in_parent); 770 window_state->SetBoundsDirectAnimated(center_in_parent);
771 } 771 }
772 // Centering window is treated as if a user moved and resized the window. 772 // Centering window is treated as if a user moved and resized the window.
773 window_state->set_bounds_changed_by_user(true); 773 window_state->set_bounds_changed_by_user(true);
774 } 774 }
775 775
776 } // namespace wm 776 } // namespace wm
777 } // namespace ash 777 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698