Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 // window at the bounds that the user has moved/resized the | 455 // window at the bounds that the user has moved/resized the |
| 456 // window to. ClearRestoreBounds() is used instead of | 456 // window to. ClearRestoreBounds() is used instead of |
| 457 // SaveCurrentBoundsForRestore() because most of the restore | 457 // SaveCurrentBoundsForRestore() because most of the restore |
| 458 // logic is skipped because we are still in the middle of a | 458 // logic is skipped because we are still in the middle of a |
| 459 // drag. TODO(pkotwicz): Fix this and use | 459 // drag. TODO(pkotwicz): Fix this and use |
| 460 // SaveCurrentBoundsForRestore(). | 460 // SaveCurrentBoundsForRestore(). |
| 461 window_state()->ClearRestoreBounds(); | 461 window_state()->ClearRestoreBounds(); |
| 462 window_state()->Restore(); | 462 window_state()->Restore(); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 gfx::Rect maximized_bounds = ScreenUtil::GetMaximizedWindowBoundsInParent( | |
| 466 GetTarget()); | |
| 467 if (!snapped && | |
|
msw
2014/07/30 05:46:37
nit: a brief comment for this block would be nice.
varkha
2014/07/30 21:03:15
Done.
| |
| 468 GetTarget()->bounds() == maximized_bounds && | |
| 469 window_state()->CanMaximize()) { | |
| 470 gfx::Rect initial_bounds = ScreenUtil::ConvertRectToScreen( | |
| 471 GetTarget()->parent(), details().initial_bounds_in_parent); | |
| 472 window_state()->SetRestoreBoundsInScreen( | |
| 473 details().restore_bounds.IsEmpty() ? | |
| 474 initial_bounds : | |
| 475 details().restore_bounds); | |
| 476 window_state()->Maximize(); | |
| 477 } | |
| 465 } | 478 } |
| 466 | 479 |
| 467 void WorkspaceWindowResizer::RevertDrag() { | 480 void WorkspaceWindowResizer::RevertDrag() { |
| 468 window_state()->set_bounds_changed_by_user(initial_bounds_changed_by_user_); | 481 window_state()->set_bounds_changed_by_user(initial_bounds_changed_by_user_); |
| 469 snap_phantom_window_controller_.reset(); | 482 snap_phantom_window_controller_.reset(); |
| 470 | 483 |
| 471 if (!did_move_or_resize_) | 484 if (!did_move_or_resize_) |
| 472 return; | 485 return; |
| 473 | 486 |
| 474 GetTarget()->SetBounds(details().initial_bounds_in_parent); | 487 GetTarget()->SetBounds(details().initial_bounds_in_parent); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); | 1051 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); |
| 1039 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 1052 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 1040 GetTarget()); | 1053 GetTarget()); |
| 1041 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) | 1054 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) |
| 1042 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); | 1055 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); |
| 1043 snapped_bounds.set_width(bounds_in_parent.width()); | 1056 snapped_bounds.set_width(bounds_in_parent.width()); |
| 1044 return bounds_in_parent == snapped_bounds; | 1057 return bounds_in_parent == snapped_bounds; |
| 1045 } | 1058 } |
| 1046 | 1059 |
| 1047 } // namespace ash | 1060 } // namespace ash |
| OLD | NEW |