| OLD | NEW |
| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 bounds_in_parent.width() >= work_area_in_parent.width() && | 675 bounds_in_parent.width() >= work_area_in_parent.width() && |
| 676 bounds_in_parent.height() >= work_area_in_parent.height()) { | 676 bounds_in_parent.height() >= work_area_in_parent.height()) { |
| 677 bounds_in_parent = work_area_in_parent; | 677 bounds_in_parent = work_area_in_parent; |
| 678 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset, | 678 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset, |
| 679 kMaximizedWindowInset, kMaximizedWindowInset); | 679 kMaximizedWindowInset, kMaximizedWindowInset); |
| 680 } | 680 } |
| 681 } else { | 681 } else { |
| 682 bounds_in_parent = window->GetBounds(); | 682 bounds_in_parent = window->GetBounds(); |
| 683 } | 683 } |
| 684 // Make sure that part of the window is always visible. | 684 // Make sure that part of the window is always visible. |
| 685 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, | 685 if (!window_state->is_dragged()) { |
| 686 &bounds_in_parent); | 686 // Avoid doing this while the window is being dragged as its root |
| 687 // window hasn't been updated yet in the case of dragging to another |
| 688 // display. crbug.com/666836. |
| 689 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, |
| 690 &bounds_in_parent); |
| 691 } |
| 687 break; | 692 break; |
| 688 } | 693 } |
| 689 case WINDOW_STATE_TYPE_MAXIMIZED: | 694 case WINDOW_STATE_TYPE_MAXIMIZED: |
| 690 bounds_in_parent = GetMaximizedWindowBoundsInParent(window); | 695 bounds_in_parent = GetMaximizedWindowBoundsInParent(window); |
| 691 break; | 696 break; |
| 692 | 697 |
| 693 case WINDOW_STATE_TYPE_FULLSCREEN: | 698 case WINDOW_STATE_TYPE_FULLSCREEN: |
| 694 case WINDOW_STATE_TYPE_PINNED: | 699 case WINDOW_STATE_TYPE_PINNED: |
| 695 case WINDOW_STATE_TYPE_TRUSTED_PINNED: | 700 case WINDOW_STATE_TYPE_TRUSTED_PINNED: |
| 696 bounds_in_parent = GetDisplayBoundsInParent(window); | 701 bounds_in_parent = GetDisplayBoundsInParent(window); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); |
| 764 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 769 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
| 765 window_state->SetBoundsDirectAnimated(center_in_parent); | 770 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 766 } | 771 } |
| 767 // 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. |
| 768 window_state->set_bounds_changed_by_user(true); | 773 window_state->set_bounds_changed_by_user(true); |
| 769 } | 774 } |
| 770 | 775 |
| 771 } // namespace wm | 776 } // namespace wm |
| 772 } // namespace ash | 777 } // namespace ash |
| OLD | NEW |