Chromium Code Reviews| 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 25430933827c63762fb0e9b7dcc1cc1d348f5370..cb8baaf821704ef32d849d3cf7c32c212e454b49 100644 |
| --- a/ash/wm/workspace/workspace_window_resizer.cc |
| +++ b/ash/wm/workspace/workspace_window_resizer.cc |
| @@ -16,6 +16,8 @@ |
| #include "ash/shell_window_ids.h" |
| #include "ash/wm/coordinate_conversion.h" |
| #include "ash/wm/default_window_resizer.h" |
| +#include "ash/wm/dock/dock_layout_manager.h" |
| +#include "ash/wm/dock/dock_window_resizer.h" |
| #include "ash/wm/drag_window_resizer.h" |
| #include "ash/wm/panels/panel_window_resizer.h" |
| #include "ash/wm/property_util.h" |
| @@ -65,7 +67,11 @@ scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, |
| window_resizer = internal::DragWindowResizer::Create( |
| window_resizer, window, point_in_parent, window_component); |
| } |
| - if (window_resizer && window->type() == aura::client::WINDOW_TYPE_PANEL) { |
| + if (window_resizer && GetDockEdge(window) != DOCK_EDGE_NONE) { |
| + window_resizer = DockWindowResizer::Create( |
| + window_resizer, window, point_in_parent, window_component); |
| + } else if (window_resizer && |
| + window->type() == aura::client::WINDOW_TYPE_PANEL) { |
|
stevenjb
2013/06/03 18:19:03
align
varkha
2013/06/03 21:03:17
Done.
|
| window_resizer = PanelWindowResizer::Create( |
| window_resizer, window, point_in_parent, window_component); |
| } |
| @@ -220,6 +226,13 @@ uint32 WindowComponentToMagneticEdge(int window_component) { |
| return 0; |
| } |
| +internal::DockLayoutManager* GetDockLayoutManager(aura::Window* window) { |
| + aura::Window* dock_container = Shell::GetContainer( |
| + window->GetRootWindow(), internal::kShellWindowId_DockContainer); |
| + return static_cast<internal::DockLayoutManager*>( |
| + dock_container->layout_manager()); |
| +} |
| + |
| } // namespace |
| // static |
| @@ -303,6 +316,13 @@ class WindowSize { |
| WorkspaceWindowResizer::~WorkspaceWindowResizer() { |
| Shell* shell = Shell::GetInstance(); |
| shell->cursor_manager()->UnlockCursor(); |
| + |
| + if (GetDockEdge(window()) != dock_edge_ && |
| + CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshEnableDockedWindows)) |
| + if (window()->type() != aura::client::WINDOW_TYPE_PANEL || |
| + !window()->GetProperty(internal::kPanelAttachedKey)) |
| + SetDockEdge(window(), dock_edge_); |
| } |
| // static |
| @@ -368,7 +388,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) { |
| if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
| return; |
| - // When the window is not in the normal show state, we do not snap thw window. |
| + // When the window is not in the normal show state, we do not snap the window. |
| // This happens when the user minimizes or maximizes the window by keyboard |
| // shortcut while dragging it. If the window is the result of dragging a tab |
| // out of a maximized window, it's already in the normal show state when this |
| @@ -433,6 +453,7 @@ WorkspaceWindowResizer::WorkspaceWindowResizer( |
| total_min_(0), |
| total_initial_size_(0), |
| snap_type_(SNAP_NONE), |
| + dock_edge_(DOCK_EDGE_NONE), |
| num_mouse_moves_since_bounds_change_(0), |
| magnetism_window_(NULL) { |
| DCHECK(details_.is_resizable); |
| @@ -683,6 +704,7 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow( |
| if (sticky_size > 0) { |
| StickToWorkAreaOnMove(work_area, sticky_size, bounds); |
| MagneticallySnapToOtherWindows(bounds); |
| + dock_edge_ = FindDockEdge(*bounds); |
| } |
| } else if (sticky_size > 0) { |
| MagneticallySnapResizeToOtherWindows(bounds); |
| @@ -756,6 +778,16 @@ void WorkspaceWindowResizer::StickToWorkAreaOnResize( |
| } |
| } |
| +ash::DockEdge WorkspaceWindowResizer::FindDockEdge( |
| + const gfx::Rect& bounds) const { |
|
stevenjb
2013/06/03 18:19:03
This seems like it should be either a static in Do
varkha
2013/06/03 21:03:17
Done (as a static in DockLayoutManager). Also move
|
| + DockEdge dock_edge = DOCK_EDGE_NONE; |
| + DockLayoutManager* dock_layout = GetDockLayoutManager(window()); |
| + if (dock_layout) |
| + dock_edge = dock_layout->FindDockEdge(bounds); |
| + |
| + return dock_edge; |
| +} |
| + |
| int WorkspaceWindowResizer::PrimaryAxisSize(const gfx::Size& size) const { |
| return PrimaryAxisCoordinate(size.width(), size.height()); |
| } |