| 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/display/window_tree_host_manager.h" | 12 #include "ash/display/window_tree_host_manager.h" |
| 13 #include "ash/metrics/user_metrics_recorder.h" | 13 #include "ash/metrics/user_metrics_recorder.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_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
| 18 #include "ash/wm/common/window_positioning_utils.h" |
| 18 #include "ash/wm/common/wm_event.h" | 19 #include "ash/wm/common/wm_event.h" |
| 19 #include "ash/wm/default_window_resizer.h" | 20 #include "ash/wm/default_window_resizer.h" |
| 20 #include "ash/wm/dock/docked_window_layout_manager.h" | 21 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 21 #include "ash/wm/dock/docked_window_resizer.h" | 22 #include "ash/wm/dock/docked_window_resizer.h" |
| 22 #include "ash/wm/drag_window_resizer.h" | 23 #include "ash/wm/drag_window_resizer.h" |
| 23 #include "ash/wm/panels/panel_window_resizer.h" | 24 #include "ash/wm/panels/panel_window_resizer.h" |
| 24 #include "ash/wm/window_state.h" | 25 #include "ash/wm/window_state.h" |
| 25 #include "ash/wm/window_state_aura.h" | 26 #include "ash/wm/window_state_aura.h" |
| 26 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
| 27 #include "ash/wm/workspace/phantom_window_controller.h" | 28 #include "ash/wm/workspace/phantom_window_controller.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 (!can_snap || | 960 (!can_snap || |
| 960 GetTarget()->bounds().width() <= | 961 GetTarget()->bounds().width() <= |
| 961 DockedWindowLayoutManager::kMaxDockWidth || | 962 DockedWindowLayoutManager::kMaxDockWidth || |
| 962 edge_cycler_->use_second_mode() || | 963 edge_cycler_->use_second_mode() || |
| 963 dock_layout_->is_dragged_window_docked()); | 964 dock_layout_->is_dragged_window_docked()); |
| 964 if (should_dock) { | 965 if (should_dock) { |
| 965 SetDraggedWindowDocked(true); | 966 SetDraggedWindowDocked(true); |
| 966 phantom_bounds = ScreenUtil::ConvertRectFromScreen( | 967 phantom_bounds = ScreenUtil::ConvertRectFromScreen( |
| 967 GetTarget()->parent(), dock_layout_->dragged_bounds()); | 968 GetTarget()->parent(), dock_layout_->dragged_bounds()); |
| 968 } else { | 969 } else { |
| 969 phantom_bounds = (snap_type_ == SNAP_LEFT) ? | 970 phantom_bounds = (snap_type_ == SNAP_LEFT) |
| 970 wm::GetDefaultLeftSnappedWindowBoundsInParent(GetTarget()) : | 971 ? wm::GetDefaultLeftSnappedWindowBoundsInParent( |
| 971 wm::GetDefaultRightSnappedWindowBoundsInParent(GetTarget()); | 972 wm::WmWindowAura::Get(GetTarget())) |
| 973 : wm::GetDefaultRightSnappedWindowBoundsInParent( |
| 974 wm::WmWindowAura::Get(GetTarget())); |
| 972 } | 975 } |
| 973 | 976 |
| 974 if (!snap_phantom_window_controller_) { | 977 if (!snap_phantom_window_controller_) { |
| 975 snap_phantom_window_controller_.reset( | 978 snap_phantom_window_controller_.reset( |
| 976 new PhantomWindowController(GetTarget())); | 979 new PhantomWindowController(GetTarget())); |
| 977 } | 980 } |
| 978 snap_phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( | 981 snap_phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( |
| 979 GetTarget()->parent(), phantom_bounds)); | 982 GetTarget()->parent(), phantom_bounds)); |
| 980 } | 983 } |
| 981 | 984 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); | 1058 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); |
| 1056 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 1059 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 1057 GetTarget()); | 1060 GetTarget()); |
| 1058 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) | 1061 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) |
| 1059 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); | 1062 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); |
| 1060 snapped_bounds.set_width(bounds_in_parent.width()); | 1063 snapped_bounds.set_width(bounds_in_parent.width()); |
| 1061 return bounds_in_parent == snapped_bounds; | 1064 return bounds_in_parent == snapped_bounds; |
| 1062 } | 1065 } |
| 1063 | 1066 |
| 1064 } // namespace ash | 1067 } // namespace ash |
| OLD | NEW |