| 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> |
| 11 | 11 |
| 12 #include "ash/metrics/user_metrics_action.h" | 12 #include "ash/metrics/user_metrics_action.h" |
| 13 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
| 14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 15 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/shell_port.h" | 17 #include "ash/shell_port.h" |
| 18 #include "ash/wm/default_window_resizer.h" | 18 #include "ash/wm/default_window_resizer.h" |
| 19 #include "ash/wm/panels/panel_window_resizer.h" | 19 #include "ash/wm/panels/panel_window_resizer.h" |
| 20 #include "ash/wm/window_positioning_utils.h" | 20 #include "ash/wm/window_positioning_utils.h" |
| 21 #include "ash/wm/window_state.h" | 21 #include "ash/wm/window_state.h" |
| 22 #include "ash/wm/wm_event.h" | 22 #include "ash/wm/wm_event.h" |
| 23 #include "ash/wm/workspace/phantom_window_controller.h" | 23 #include "ash/wm/workspace/phantom_window_controller.h" |
| 24 #include "ash/wm/workspace/two_step_edge_cycler.h" | 24 #include "ash/wm/workspace/two_step_edge_cycler.h" |
| 25 #include "ash/wm_window.h" | |
| 26 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
| 27 #include "base/memory/weak_ptr.h" | 26 #include "base/memory/weak_ptr.h" |
| 28 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 29 #include "ui/aura/window_delegate.h" | 28 #include "ui/aura/window_delegate.h" |
| 30 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
| 31 #include "ui/compositor/layer.h" | 30 #include "ui/compositor/layer.h" |
| 32 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
| 33 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
| 34 #include "ui/gfx/transform.h" | 33 #include "ui/gfx/transform.h" |
| 35 #include "ui/wm/core/coordinate_conversion.h" | 34 #include "ui/wm/core/coordinate_conversion.h" |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 } | 887 } |
| 889 | 888 |
| 890 // Update phantom window with snapped guide bounds. | 889 // Update phantom window with snapped guide bounds. |
| 891 const gfx::Rect phantom_bounds = | 890 const gfx::Rect phantom_bounds = |
| 892 (snap_type_ == SNAP_LEFT) | 891 (snap_type_ == SNAP_LEFT) |
| 893 ? wm::GetDefaultLeftSnappedWindowBoundsInParent(GetTarget()) | 892 ? wm::GetDefaultLeftSnappedWindowBoundsInParent(GetTarget()) |
| 894 : wm::GetDefaultRightSnappedWindowBoundsInParent(GetTarget()); | 893 : wm::GetDefaultRightSnappedWindowBoundsInParent(GetTarget()); |
| 895 | 894 |
| 896 if (!snap_phantom_window_controller_) { | 895 if (!snap_phantom_window_controller_) { |
| 897 snap_phantom_window_controller_ = | 896 snap_phantom_window_controller_ = |
| 898 base::MakeUnique<PhantomWindowController>(WmWindow::Get(GetTarget())); | 897 base::MakeUnique<PhantomWindowController>(GetTarget()); |
| 899 } | 898 } |
| 900 gfx::Rect phantom_bounds_in_screen(phantom_bounds); | 899 gfx::Rect phantom_bounds_in_screen(phantom_bounds); |
| 901 ::wm::ConvertRectToScreen(GetTarget()->parent(), &phantom_bounds_in_screen); | 900 ::wm::ConvertRectToScreen(GetTarget()->parent(), &phantom_bounds_in_screen); |
| 902 snap_phantom_window_controller_->Show(phantom_bounds_in_screen); | 901 snap_phantom_window_controller_->Show(phantom_bounds_in_screen); |
| 903 } | 902 } |
| 904 | 903 |
| 905 void WorkspaceWindowResizer::RestackWindows() { | 904 void WorkspaceWindowResizer::RestackWindows() { |
| 906 if (attached_windows_.empty()) | 905 if (attached_windows_.empty()) |
| 907 return; | 906 return; |
| 908 // Build a map from index in children to window, returning if there is a | 907 // Build a map from index in children to window, returning if there is a |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); | 961 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); |
| 963 gfx::Rect snapped_bounds = | 962 gfx::Rect snapped_bounds = |
| 964 ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()); | 963 ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()); |
| 965 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) | 964 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) |
| 966 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); | 965 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); |
| 967 snapped_bounds.set_width(bounds_in_parent.width()); | 966 snapped_bounds.set_width(bounds_in_parent.width()); |
| 968 return bounds_in_parent == snapped_bounds; | 967 return bounds_in_parent == snapped_bounds; |
| 969 } | 968 } |
| 970 | 969 |
| 971 } // namespace ash | 970 } // namespace ash |
| OLD | NEW |