| Index: ui/views/corewm/window_resizer.cc
|
| ===================================================================
|
| --- ui/views/corewm/window_resizer.cc (revision 173169)
|
| +++ ui/views/corewm/window_resizer.cc (working copy)
|
| @@ -2,12 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ash/wm/window_resizer.h"
|
| +#include "ui/views/corewm/window_resizer.h"
|
|
|
| -#include "ash/screen_ash.h"
|
| -#include "ash/shell.h"
|
| -#include "ash/wm/property_util.h"
|
| -#include "ash/wm/window_util.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/window.h"
|
| @@ -17,11 +13,18 @@
|
| #include "ui/compositor/scoped_layer_animation_settings.h"
|
| #include "ui/gfx/display.h"
|
| #include "ui/gfx/screen.h"
|
| +#include "ui/views/corewm/screen_util.h"
|
| +#include "ui/views/corewm/window_util.h"
|
|
|
| -namespace ash {
|
| +namespace views {
|
| +namespace corewm {
|
|
|
| namespace {
|
|
|
| +// TODO(beng): figure out if we want to host this constant in corewm.
|
| +// We force at least this many DIPs for any window on the screen.
|
| +const int kMinimumOnScreenArea = 10;
|
| +
|
| int GetPositionChangeDirectionForWindowComponent(int window_component) {
|
| int pos_change_direction = WindowResizer::kBoundsChangeDirection_None;
|
| switch (window_component) {
|
| @@ -125,7 +128,7 @@
|
| size_change_direction(
|
| GetSizeChangeDirectionForWindowComponent(window_component)),
|
| is_resizable(bounds_change != kBoundsChangeDirection_None) {
|
| - if (wm::IsWindowNormal(window) &&
|
| + if (IsWindowNormal(window) &&
|
| GetRestoreBoundsInScreen(window) &&
|
| window_component == HTCAPTION)
|
| restore_bounds = *GetRestoreBoundsInScreen(window);
|
| @@ -175,8 +178,7 @@
|
| return details.initial_bounds_in_parent;
|
|
|
| gfx::Point location = passed_location;
|
| - gfx::Rect work_area =
|
| - ScreenAsh::GetDisplayWorkAreaBoundsInParent(details.window);
|
| + gfx::Rect work_area = GetDisplayWorkAreaBoundsInParent(details.window);
|
|
|
| int delta_x = location.x() - details.initial_location_in_parent.x();
|
| int delta_y = location.y() - details.initial_location_in_parent.y();
|
| @@ -244,10 +246,9 @@
|
| // 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 = details.window->parent();
|
| - gfx::Rect new_bounds_in_screen =
|
| - ScreenAsh::ConvertRectToScreen(parent, new_bounds);
|
| - const gfx::Display& display =
|
| - Shell::GetScreen()->GetDisplayMatching(new_bounds_in_screen);
|
| + gfx::Rect new_bounds_in_screen = ConvertRectToScreen(parent, new_bounds);
|
| + const gfx::Display& display = gfx::Screen::GetScreenFor(parent)->
|
| + GetDisplayMatching(new_bounds_in_screen);
|
| gfx::Rect screen_work_area = display.work_area();
|
| screen_work_area.Inset(kMinimumOnScreenArea, 0);
|
| if (!screen_work_area.Intersects(new_bounds_in_screen)) {
|
| @@ -256,8 +257,7 @@
|
| std::max(screen_work_area.x() - new_bounds.width(),
|
| std::min(screen_work_area.right(),
|
| new_bounds_in_screen.x())));
|
| - new_bounds =
|
| - ScreenAsh::ConvertRectFromScreen(parent, new_bounds_in_screen);
|
| + new_bounds = ConvertRectFromScreen(parent, new_bounds_in_screen);
|
| }
|
| }
|
|
|
| @@ -322,8 +322,8 @@
|
| }
|
|
|
| // And don't let the window go bigger than the display.
|
| - int max_width = Shell::GetScreen()->GetDisplayNearestWindow(
|
| - details.window).bounds().width();
|
| + int max_width = gfx::Screen::GetScreenFor(details.window)->
|
| + GetDisplayNearestWindow(details.window).bounds().width();
|
| gfx::Size max_size = details.window->delegate()->GetMaximumSize();
|
| if (max_size.width() != 0)
|
| max_width = std::min(max_width, max_size.width());
|
| @@ -355,8 +355,8 @@
|
| }
|
|
|
| // And don't let the window go bigger than the display.
|
| - int max_height = Shell::GetScreen()->GetDisplayNearestWindow(
|
| - details.window).bounds().height();
|
| + int max_height = gfx::Screen::GetScreenFor(details.window)->
|
| + GetDisplayNearestWindow(details.window).bounds().height();
|
| gfx::Size max_size = details.window->delegate()->GetMaximumSize();
|
| if (max_size.height() != 0)
|
| max_height = std::min(max_height, max_size.height());
|
| @@ -369,4 +369,5 @@
|
| return height;
|
| }
|
|
|
| -} // namespace aura
|
| +} // namespace corewm
|
| +} // namespace views
|
|
|