| Index: ash/wm/window_resizer.cc
|
| diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc
|
| index c0f2ca595a8fbd9155f58668dcb670eab7cbf543..cad9947bd84706d40d7f3492d6dcc51a1891d17d 100644
|
| --- a/ash/wm/window_resizer.cc
|
| +++ b/ash/wm/window_resizer.cc
|
| @@ -4,24 +4,17 @@
|
|
|
| #include "ash/wm/window_resizer.h"
|
|
|
| -#include "ash/screen_util.h"
|
| -#include "ash/shell.h"
|
| #include "ash/shell_window_ids.h"
|
| +#include "ash/wm/common/root_window_finder.h"
|
| #include "ash/wm/common/window_positioning_utils.h"
|
| -#include "ash/wm/coordinate_conversion.h"
|
| #include "ash/wm/dock/docked_window_layout_manager.h"
|
| #include "ash/wm/window_state.h"
|
| -#include "ash/wm/window_util.h"
|
| -#include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/window.h"
|
| -#include "ui/aura/window_delegate.h"
|
| -#include "ui/aura/window_event_dispatcher.h"
|
| #include "ui/base/hit_test.h"
|
| #include "ui/base/ui_base_types.h"
|
| -#include "ui/compositor/scoped_layer_animation_settings.h"
|
| #include "ui/gfx/display.h"
|
| +#include "ui/gfx/geometry/rect.h"
|
| #include "ui/gfx/screen.h"
|
| -#include "ui/wm/core/coordinate_conversion.h"
|
|
|
| namespace ash {
|
|
|
| @@ -138,18 +131,16 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
|
| // has to come first since it might have an impact on the origin as well as
|
| // on the size.
|
| if (details().bounds_change & kBoundsChange_Resizes) {
|
| - gfx::Rect work_area = gfx::Screen::GetScreen()
|
| - ->GetDisplayNearestWindow(GetTarget())
|
| - .work_area();
|
| - aura::Window* dock_container = Shell::GetContainer(
|
| - GetTarget()->GetRootWindow(), kShellWindowId_DockedContainer);
|
| + gfx::Rect work_area = GetTarget()->GetDisplayNearestWindow().work_area();
|
| + wm::WmWindow* dock_container =
|
| + GetTarget()->GetRootWindow()->GetChildByShellWindowId(
|
| + kShellWindowId_DockedContainer);
|
| DockedWindowLayoutManager* dock_layout =
|
| static_cast<DockedWindowLayoutManager*>(
|
| - dock_container->layout_manager());
|
| + wm::WmWindowAura::GetAuraWindow(dock_container)->layout_manager());
|
|
|
| work_area.Union(dock_layout->docked_bounds());
|
| - work_area = ScreenUtil::ConvertRectFromScreen(GetTarget()->parent(),
|
| - work_area);
|
| + work_area = GetTarget()->GetParent()->ConvertRectFromScreen(work_area);
|
| if (details().size_change_direction & kBoundsChangeDirection_Horizontal) {
|
| if (IsRightEdge(details().window_component) &&
|
| new_bounds.right() < work_area.x() + wm::kMinimumOnScreenArea) {
|
| @@ -204,34 +195,32 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
|
| // Make sure that |new_bounds| doesn't leave any of the displays. Note that
|
| // the |work_area| above isn't good for this check since it is the work area
|
| // for the current display but the window can move to a different one.
|
| - aura::Window* parent = GetTarget()->parent();
|
| - gfx::Point passed_location_in_screen(passed_location);
|
| - ::wm::ConvertPointToScreen(parent, &passed_location_in_screen);
|
| + wm::WmWindow* parent = GetTarget()->GetParent();
|
| + gfx::Point passed_location_in_screen(
|
| + parent->ConvertPointToScreen(passed_location));
|
| gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size());
|
| // Use a pointer location (matching the logic in DragWindowResizer) to
|
| // calculate the target display after the drag.
|
| const gfx::Display& display =
|
| gfx::Screen::GetScreen()->GetDisplayMatching(near_passed_location);
|
| - aura::Window* dock_container =
|
| - Shell::GetContainer(wm::GetRootWindowMatching(near_passed_location),
|
| - kShellWindowId_DockedContainer);
|
| + wm::WmWindow* dock_container =
|
| + wm::GetRootWindowMatching(near_passed_location)
|
| + ->GetChildByShellWindowId(kShellWindowId_DockedContainer);
|
| DockedWindowLayoutManager* dock_layout =
|
| static_cast<DockedWindowLayoutManager*>(
|
| - dock_container->layout_manager());
|
| + wm::WmWindowAura::GetAuraWindow(dock_container)->layout_manager());
|
|
|
| gfx::Rect screen_work_area = display.work_area();
|
| screen_work_area.Union(dock_layout->docked_bounds());
|
| screen_work_area.Inset(wm::kMinimumOnScreenArea, 0);
|
| - gfx::Rect new_bounds_in_screen =
|
| - ScreenUtil::ConvertRectToScreen(parent, new_bounds);
|
| + gfx::Rect new_bounds_in_screen = parent->ConvertRectToScreen(new_bounds);
|
| if (!screen_work_area.Intersects(new_bounds_in_screen)) {
|
| // Make sure that the x origin does not leave the current display.
|
| new_bounds_in_screen.set_x(
|
| std::max(screen_work_area.x() - new_bounds.width(),
|
| std::min(screen_work_area.right(),
|
| new_bounds_in_screen.x())));
|
| - new_bounds =
|
| - ScreenUtil::ConvertRectFromScreen(parent, new_bounds_in_screen);
|
| + new_bounds = parent->ConvertRectFromScreen(new_bounds_in_screen);
|
| }
|
| }
|
|
|
| @@ -287,7 +276,7 @@ gfx::Point WindowResizer::GetOriginForDrag(int delta_x, int delta_y) {
|
| gfx::Size WindowResizer::GetSizeForDrag(int* delta_x, int* delta_y) {
|
| gfx::Size size = details().initial_bounds_in_parent.size();
|
| if (details().bounds_change & kBoundsChange_Resizes) {
|
| - gfx::Size min_size = GetTarget()->delegate()->GetMinimumSize();
|
| + gfx::Size min_size = GetTarget()->GetMinimumSize();
|
| size.SetSize(GetWidthForDrag(min_size.width(), delta_x),
|
| GetHeightForDrag(min_size.height(), delta_y));
|
| } else if (!details().restore_bounds.IsEmpty()) {
|
| @@ -312,11 +301,8 @@ int WindowResizer::GetWidthForDrag(int min_width, int* delta_x) {
|
| }
|
|
|
| // And don't let the window go bigger than the display.
|
| - int max_width = gfx::Screen::GetScreen()
|
| - ->GetDisplayNearestWindow(GetTarget())
|
| - .bounds()
|
| - .width();
|
| - gfx::Size max_size = GetTarget()->delegate()->GetMaximumSize();
|
| + int max_width = GetTarget()->GetDisplayNearestWindow().bounds().width();
|
| + gfx::Size max_size = GetTarget()->GetMaximumSize();
|
| if (max_size.width() != 0)
|
| max_width = std::min(max_width, max_size.width());
|
| if (width > max_width) {
|
| @@ -344,11 +330,8 @@ int WindowResizer::GetHeightForDrag(int min_height, int* delta_y) {
|
| }
|
|
|
| // And don't let the window go bigger than the display.
|
| - int max_height = gfx::Screen::GetScreen()
|
| - ->GetDisplayNearestWindow(GetTarget())
|
| - .bounds()
|
| - .height();
|
| - gfx::Size max_size = GetTarget()->delegate()->GetMaximumSize();
|
| + int max_height = GetTarget()->GetDisplayNearestWindow().bounds().height();
|
| + gfx::Size max_size = GetTarget()->GetMaximumSize();
|
| if (max_size.height() != 0)
|
| max_height = std::min(max_height, max_size.height());
|
| if (height > max_height) {
|
|
|