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

Unified Diff: ash/wm/gestures/system_pinch_handler.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/gestures/system_pinch_handler.cc
diff --git a/ash/wm/gestures/system_pinch_handler.cc b/ash/wm/gestures/system_pinch_handler.cc
index a0f5d12e00b04642df7a0f6a552d6e5dd80ac397..18ad4cf33b48a2df8773d71b0b2222a7305462c9 100644
--- a/ash/wm/gestures/system_pinch_handler.cc
+++ b/ash/wm/gestures/system_pinch_handler.cc
@@ -8,8 +8,8 @@
#include "ash/screen_ash.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
-#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
+#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "ui/aura/window.h"
@@ -44,22 +44,20 @@ SystemGestureStatus SystemPinchHandler::ProcessGestureEvent(
// The target has changed, somehow. Let's bale.
if (!widget_ || !widget_->widget_delegate()->CanResize())
return SYSTEM_GESTURE_END;
-
+ wm::WindowState* window_state = wm::GetWindowState(target_);
switch (event.type()) {
case ui::ET_GESTURE_END: {
if (event.details().touch_points() > kSystemGesturePoints)
break;
if (phantom_state_ == PHANTOM_WINDOW_MAXIMIZED) {
- if (!wm::IsWindowMaximized(target_) &&
- !wm::IsWindowFullscreen(target_))
- wm::MaximizeWindow(target_);
+ if (!window_state->IsMaximizedOrFullscreen())
+ window_state->Maximize();
} else if (phantom_state_ == PHANTOM_WINDOW_MINIMIZED) {
- if (wm::IsWindowMaximized(target_) ||
- wm::IsWindowFullscreen(target_)) {
- wm::RestoreWindow(target_);
+ if (window_state->IsMaximizedOrFullscreen()) {
+ window_state->Restore();
} else {
- wm::MinimizeWindow(target_);
+ window_state->Minimize();
// NOTE: Minimizing the window will cause this handler to be
// destroyed. So do not access anything from |this| from here.
@@ -92,11 +90,10 @@ SystemGestureStatus SystemPinchHandler::ProcessGestureEvent(
event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE :
internal::SnapSizer::RIGHT_EDGE);
} else if (event.details().swipe_up()) {
- if (!wm::IsWindowMaximized(target_) &&
- !wm::IsWindowFullscreen(target_))
- wm::MaximizeWindow(target_);
+ if (!window_state->IsMaximizedOrFullscreen())
+ window_state->Maximize();
} else if (event.details().swipe_down()) {
- wm::MinimizeWindow(target_);
+ window_state->Minimize();
} else {
NOTREACHED() << "Swipe happened without a direction.";
}
@@ -121,11 +118,11 @@ gfx::Rect SystemPinchHandler::GetPhantomWindowScreenBounds(
}
if (pinch_factor_ < kPinchThresholdForMinimize) {
- if (wm::IsWindowMaximized(window) || wm::IsWindowFullscreen(window)) {
- const gfx::Rect* restore = GetRestoreBoundsInScreen(window);
- if (restore) {
+ wm::WindowState* window_state = wm::GetWindowState(window);
+ if (window_state->IsMaximizedOrFullscreen()) {
+ if (window_state->HasRestoreBounds()) {
phantom_state_ = PHANTOM_WINDOW_MINIMIZED;
- return *restore;
+ return window_state->GetRestoreBoundsInScreen();
}
return window->bounds();
}

Powered by Google App Engine
This is Rietveld 408576698