| Index: ash/wm/workspace/workspace_window_resizer.cc
|
| diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
|
| index 731fcb37a92ac3e24bc558ee1c89428d34e25b00..dab583548395444b258213c2b0805bf46c418491 100644
|
| --- a/ash/wm/workspace/workspace_window_resizer.cc
|
| +++ b/ash/wm/workspace/workspace_window_resizer.cc
|
| @@ -95,8 +95,7 @@ scoped_ptr<WindowResizer> CreateWindowResizer(
|
| window_resizer = PanelWindowResizer::Create(
|
| window_resizer, window, point_in_parent, window_component, source);
|
| }
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kAshEnableDockedWindows) &&
|
| + if (switches::UseDockedWindows() &&
|
| window_resizer && window->parent() &&
|
| !window->transient_parent() &&
|
| (window->parent()->id() == internal::kShellWindowId_DefaultContainer ||
|
| @@ -117,19 +116,6 @@ namespace {
|
| // when resizing a window using touchscreen.
|
| const int kScreenEdgeInsetForTouchResize = 32;
|
|
|
| -// Returns true if the window should stick to the edge.
|
| -bool ShouldStickToEdge(int distance_from_edge, int sticky_size) {
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kAshEnableStickyEdges) ||
|
| - CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kAshEnableDockedWindows)) {
|
| - return distance_from_edge < 0 &&
|
| - distance_from_edge > -sticky_size;
|
| - }
|
| - return distance_from_edge < sticky_size &&
|
| - distance_from_edge > -sticky_size * 2;
|
| -}
|
| -
|
| // Returns the coordinate along the secondary axis to snap to.
|
| int CoordinateAlongSecondaryAxis(SecondaryMagnetismEdge edge,
|
| int leading,
|
| @@ -273,6 +259,9 @@ const int WorkspaceWindowResizer::kScreenEdgeInset = 8;
|
| // static
|
| const int WorkspaceWindowResizer::kStickyDistancePixels = 64;
|
|
|
| +// static
|
| +WorkspaceWindowResizer* WorkspaceWindowResizer::instance_ = NULL;
|
| +
|
| // Represents the width or height of a window with constraints on its minimum
|
| // and maximum size. 0 represents a lack of a constraint.
|
| class WindowSize {
|
| @@ -345,6 +334,8 @@ class WindowSize {
|
| WorkspaceWindowResizer::~WorkspaceWindowResizer() {
|
| Shell* shell = Shell::GetInstance();
|
| shell->cursor_manager()->UnlockCursor();
|
| + if (instance_ == this)
|
| + instance_ = NULL;
|
| }
|
|
|
| // static
|
| @@ -367,9 +358,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| if (event_flags & ui::EF_CONTROL_DOWN) {
|
| sticky_size = 0;
|
| } else if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kAshEnableStickyEdges) ||
|
| - CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kAshEnableDockedWindows)) {
|
| + switches::kAshEnableStickyEdges)) {
|
| sticky_size = kStickyDistancePixels;
|
| } else if ((details_.bounds_change & kBoundsChange_Resizes) &&
|
| details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| @@ -542,6 +531,7 @@ WorkspaceWindowResizer::WorkspaceWindowResizer(
|
| total_initial_size_ += initial_size;
|
| total_available += std::max(min_size, initial_size) - min_size;
|
| }
|
| + instance_ = this;
|
| }
|
|
|
| gfx::Rect WorkspaceWindowResizer::GetFinalBounds(
|
| @@ -818,6 +808,22 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
|
| }
|
| }
|
|
|
| +bool WorkspaceWindowResizer::ShouldStickToEdge(int distance_from_edge,
|
| + int sticky_size) const {
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kAshEnableStickyEdges)) {
|
| + int snapping_distance = 0;
|
| + if ((details_.bounds_change & kBoundsChange_Resizes) &&
|
| + details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| + snapping_distance = sticky_size / 2;
|
| + }
|
| + return distance_from_edge < snapping_distance &&
|
| + distance_from_edge > -sticky_size;
|
| + }
|
| + return distance_from_edge < sticky_size &&
|
| + distance_from_edge > -sticky_size * 2;
|
| +}
|
| +
|
| bool WorkspaceWindowResizer::StickToWorkAreaOnMove(
|
| const gfx::Rect& work_area,
|
| int sticky_size,
|
|
|