| Index: ash/wm/workspace/snap_sizer.cc
|
| diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
|
| index e4bdaf7b3fcc20d44a3a68a3bd602c74082aab55..d5552ec570c34df71cbf12f13356a6cec61944e0 100644
|
| --- a/ash/wm/workspace/snap_sizer.cc
|
| +++ b/ash/wm/workspace/snap_sizer.cc
|
| @@ -8,8 +8,8 @@
|
|
|
| #include "ash/ash_switches.h"
|
| #include "ash/screen_ash.h"
|
| -#include "ash/wm/property_util.h"
|
| #include "ash/wm/window_resizer.h"
|
| +#include "ash/wm/window_state.h"
|
| #include "ash/wm/window_util.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_delegate.h"
|
| @@ -149,21 +149,23 @@ SnapSizer::~SnapSizer() {
|
| }
|
|
|
| void SnapSizer::SnapWindow(aura::Window* window, SnapSizer::Edge edge) {
|
| - if (!wm::CanSnapWindow(window))
|
| + wm::WindowState* window_state = wm::GetWindowState(window);
|
| + if (!window_state->CanSnap())
|
| return;
|
| internal::SnapSizer sizer(window, gfx::Point(), edge,
|
| internal::SnapSizer::OTHER_INPUT);
|
| - if (wm::IsWindowFullscreen(window) || wm::IsWindowMaximized(window)) {
|
| + if (window_state->IsMaximizedOrFullscreen()) {
|
| // Before we can set the bounds we need to restore the window.
|
| // Restoring the window will set the window to its restored bounds.
|
| // To avoid an unnecessary bounds changes (which may have side effects)
|
| // we set the restore bounds to the bounds we want, restore the window,
|
| // then reset the restore bounds. This way no unnecessary bounds
|
| // changes occurs and the original restore bounds is remembered.
|
| - gfx::Rect restore = *GetRestoreBoundsInScreen(window);
|
| - SetRestoreBoundsInParent(window, sizer.GetSnapBounds(window->bounds()));
|
| - wm::RestoreWindow(window);
|
| - SetRestoreBoundsInScreen(window, restore);
|
| + const gfx::Rect& restore = window_state->GetRestoreBoundsInScreen();
|
| + window_state->SetRestoreBoundsInParent(
|
| + sizer.GetSnapBounds(window->bounds()));
|
| + window_state->Restore();
|
| + window_state->SetRestoreBoundsInScreen(restore);
|
| } else {
|
| window->SetBounds(sizer.GetSnapBounds(window->bounds()));
|
| }
|
|
|