summaryrefslogtreecommitdiffstats
path: root/ash/accelerators
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 13:29:37 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 13:29:37 +0000
commit489cdb18fcfe652146b9af9da6d794c2e9a02e25 (patch)
treee80ae3b729e743194d9a0cf9c1518e91f5ed549e /ash/accelerators
parentca4b88e1c47918672c14412491c44633605b2ec0 (diff)
downloadchromium_src-489cdb18fcfe652146b9af9da6d794c2e9a02e25.zip
chromium_src-489cdb18fcfe652146b9af9da6d794c2e9a02e25.tar.gz
chromium_src-489cdb18fcfe652146b9af9da6d794c2e9a02e25.tar.bz2
Refactor SnapSizer now that the --ash-multiple-snap-window-widths flag no longer exists
Notable changes: Removes the window snapping functionality out of SnapSizer Introduce SnapSizer::SnapLeftWithDefaultWidth() SnapSizer::SnapRightWithDefaultWidth() wm::GetLeftSnappedWindowBoundsInParent() wm::GetRightSnappedWindowBoundsInParent() Rename SnapSizer to TwoStepEdgeCycler and strip it down as much as possible. In a future CL I will clean up WorkspaceWindowResizer's use of TwoStepEdgeCycler. BUG=343276 Review URL: https://codereview.chromium.org/178573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/accelerators')
-rw-r--r--ash/accelerators/accelerator_controller.cc8
-rw-r--r--ash/accelerators/accelerator_controller_unittest.cc7
2 files changed, 6 insertions, 9 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 5f068a9..cae18ff 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -52,7 +52,6 @@
#include "ash/wm/window_cycle_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/snap_sizer.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/metrics/user_metrics.h"
@@ -581,9 +580,10 @@ bool HandleWindowSnap(int action) {
base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right"));
}
- internal::SnapSizer::SnapWindow(window_state,
- action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE :
- internal::SnapSizer::RIGHT_EDGE);
+ if (action == WINDOW_SNAP_LEFT)
+ window_state->SnapLeftWithDefaultWidth();
+ else
+ window_state->SnapRightWithDefaultWidth();
return true;
}
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index f61eec2..06ce213 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -480,17 +480,14 @@ TEST_F(AcceleratorControllerTest, WindowSnap) {
{
GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy);
- gfx::Rect expected_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
+ gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
window.get());
- expected_bounds.set_width(expected_bounds.width() / 2);
EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
}
{
GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy);
- gfx::Rect expected_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
+ gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent(
window.get());
- expected_bounds.set_width(expected_bounds.width() / 2);
- expected_bounds.set_x(expected_bounds.width());
EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
}
{