| 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/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 9 #include "ash/common/wm/window_animation_types.h" | 9 #include "ash/common/wm/window_animation_types.h" |
| 10 #include "ash/common/wm/window_parenting_utils.h" | 10 #include "ash/common/wm/window_parenting_utils.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // TODO(oshima|varkha): This may be no longer needed, as the dragging | 526 // TODO(oshima|varkha): This may be no longer needed, as the dragging |
| 527 // happens in docked window container. crbug.com/485612. | 527 // happens in docked window container. crbug.com/485612. |
| 528 window_state->SetBoundsDirect(event->requested_bounds()); | 528 window_state->SetBoundsDirect(event->requested_bounds()); |
| 529 } else if (window_state->IsSnapped()) { | 529 } else if (window_state->IsSnapped()) { |
| 530 gfx::Rect work_area_in_parent = | 530 gfx::Rect work_area_in_parent = |
| 531 GetDisplayWorkAreaBoundsInParent(window_state->window()); | 531 GetDisplayWorkAreaBoundsInParent(window_state->window()); |
| 532 gfx::Rect child_bounds(event->requested_bounds()); | 532 gfx::Rect child_bounds(event->requested_bounds()); |
| 533 wm::AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds); | 533 wm::AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds); |
| 534 window_state->AdjustSnappedBounds(&child_bounds); | 534 window_state->AdjustSnappedBounds(&child_bounds); |
| 535 window_state->SetBoundsDirect(child_bounds); | 535 window_state->SetBoundsDirect(child_bounds); |
| 536 } else if (!SetMaximizedOrFullscreenBounds(window_state)) { | 536 } else if (!SetMaximizedOrFullscreenBounds(window_state) || |
| 537 window_state->allow_set_bounds_in_maximized()) { |
| 537 window_state->SetBoundsConstrained(event->requested_bounds()); | 538 window_state->SetBoundsConstrained(event->requested_bounds()); |
| 538 } | 539 } |
| 539 } | 540 } |
| 540 | 541 |
| 541 void DefaultState::EnterToNextState(WindowState* window_state, | 542 void DefaultState::EnterToNextState(WindowState* window_state, |
| 542 WindowStateType next_state_type) { | 543 WindowStateType next_state_type) { |
| 543 // Do nothing if we're already in the same state. | 544 // Do nothing if we're already in the same state. |
| 544 if (state_type_ == next_state_type) | 545 if (state_type_ == next_state_type) |
| 545 return; | 546 return; |
| 546 | 547 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 753 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); |
| 753 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 754 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
| 754 window_state->SetBoundsDirectAnimated(center_in_parent); | 755 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 755 } | 756 } |
| 756 // Centering window is treated as if a user moved and resized the window. | 757 // Centering window is treated as if a user moved and resized the window. |
| 757 window_state->set_bounds_changed_by_user(true); | 758 window_state->set_bounds_changed_by_user(true); |
| 758 } | 759 } |
| 759 | 760 |
| 760 } // namespace wm | 761 } // namespace wm |
| 761 } // namespace ash | 762 } // namespace ash |
| OLD | NEW |