Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3209)

Unified Diff: ash/wm/workspace/snap_sizer.cc

Issue 24108003: [Cleanup] Rename WindowSettings to WindowState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/snap_sizer.cc
diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
index 877f101084954f47da91428451391a2825483dd1..e8dca94db0ba84eec8eeca5f34a8b2384d796788 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"
@@ -125,20 +125,22 @@ std::vector<int> BuildIdealWidthList(aura::Window* window) {
// Changes |window|'s bounds to |snap_bounds| while preserving the restore
// bounds.
-void SnapWindowToBounds(aura::Window* window, const gfx::Rect& snap_bounds) {
- if (wm::IsWindowMaximized(window) || wm::IsWindowFullscreen(window)) {
+void SnapWindowToBounds(wm::WindowState* window_state,
+ const gfx::Rect& snap_bounds) {
+ 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_bounds_in_screen = *GetRestoreBoundsInScreen(window);
- SetRestoreBoundsInParent(window, snap_bounds);
- wm::RestoreWindow(window);
- SetRestoreBoundsInScreen(window, restore_bounds_in_screen);
+ gfx::Rect restore_bounds_in_screen =
+ window_state->GetRestoreBoundsInScreen();
+ window_state->SetRestoreBoundsInParent(snap_bounds);
+ window_state->Restore();
+ window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
} else {
- window->SetBounds(snap_bounds);
+ window_state->window()->SetBounds(snap_bounds);
}
}
@@ -168,15 +170,17 @@ 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 sizer(window_state->window(), gfx::Point(), edge,
James Cook 2013/09/19 03:49:53 nit: Maybe just use |window|?
oshima 2013/09/19 17:44:05 Done.
internal::SnapSizer::OTHER_INPUT);
- SnapWindowToBounds(window, sizer.GetSnapBounds(window->bounds()));
+ SnapWindowToBounds(window_state,
+ sizer.GetSnapBounds(window_state->window()->bounds()));
}
void SnapSizer::SnapWindowToTargetBounds() {
- SnapWindowToBounds(window_, target_bounds());
+ SnapWindowToBounds(wm::GetWindowState(window_), target_bounds());
}
void SnapSizer::Update(const gfx::Point& location) {

Powered by Google App Engine
This is Rietveld 408576698