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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 11434004: ash: Refactor some code that snaps windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | ash/wm/gestures/system_pinch_handler.cc » ('j') | ash/wm/window_util.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 7f94f3b172430cb797b2ab6e17efd8f4534801a0..535f4247768b65d18ff242264f2275918dc4a8d4 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -710,26 +710,9 @@ bool AcceleratorController::PerformAction(int action,
break;
}
- internal::SnapSizer sizer(window,
- gfx::Point(),
+ wm::SnapWindow(window,
action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE :
- internal::SnapSizer::RIGHT_EDGE,
- internal::SnapSizer::OTHER_INPUT);
- if (wm::IsWindowFullscreen(window) ||
- wm::IsWindowMaximized(window)) {
- // 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);
- } else {
- window->SetBounds(sizer.GetSnapBounds(window->bounds()));
- }
+ internal::SnapSizer::RIGHT_EDGE);
return true;
}
case WINDOW_MINIMIZE: {
« no previous file with comments | « no previous file | ash/wm/gestures/system_pinch_handler.cc » ('j') | ash/wm/window_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698