| 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..eab117e48e33fc14b491fb52670d9796f6d14b39 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/docked_window_layout_manager.h"
|
| +#include "ash/wm/dock/docked_window_resizer.h"
|
| #include "ash/wm/drag_window_resizer.h"
|
| #include "ash/wm/panels/panel_window_resizer.h"
|
| #include "ash/wm/property_util.h"
|
| @@ -36,14 +38,29 @@
|
|
|
| namespace ash {
|
|
|
| -scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
|
| - const gfx::Point& point_in_parent,
|
| - int window_component) {
|
| +namespace internal {
|
| +
|
| +scoped_ptr<WindowResizer> CreateWindowResizerExposeDragResizer(
|
| + aura::Window* window,
|
| + const gfx::Point& point_in_parent,
|
| + int window_component,
|
| + DragWindowResizer** drag_resizer) {
|
| DCHECK(window);
|
| // No need to return a resizer when the window cannot get resized.
|
| if (!wm::CanResizeWindow(window) && window_component != HTCAPTION)
|
| return scoped_ptr<WindowResizer>();
|
|
|
| + // TODO(varkha): The chaining of window resizers causes some of the logic
|
| + // to be repeated and the logic flow difficult to control. With some windows
|
| + // classes using reparenting during drag operations it becomes challenging to
|
| + // implement proper transition from one resizer to another during or at the
|
| + // end of the drag. This also causes http://crbug.com/247085.
|
| + // It seems the only thing the panel or dock resizer needs to do is notify the
|
| + // layout manager when a docked window is being dragged. We should have a
|
| + // better way of doing this, perhaps by having a way of observing drags or
|
| + // having a generic drag window wrapper which informs a layout manager that a
|
| + // drag has started or stopped.
|
| + // It may be possible to refactor and eliminate chaining.
|
| WindowResizer* window_resizer = NULL;
|
| if (window->parent() &&
|
| window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) {
|
| @@ -64,16 +81,20 @@ scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
|
| if (window_resizer) {
|
| window_resizer = internal::DragWindowResizer::Create(
|
| window_resizer, window, point_in_parent, window_component);
|
| + if (drag_resizer)
|
| + *drag_resizer = static_cast<DragWindowResizer*>(window_resizer);
|
| }
|
| if (window_resizer && window->type() == aura::client::WINDOW_TYPE_PANEL) {
|
| window_resizer = PanelWindowResizer::Create(
|
| window_resizer, window, point_in_parent, window_component);
|
| }
|
| + if (window_resizer) {
|
| + window_resizer = DockedWindowResizer::Create(
|
| + window_resizer, window, point_in_parent, window_component);
|
| + }
|
| return make_scoped_ptr<WindowResizer>(window_resizer);
|
| }
|
|
|
| -namespace internal {
|
| -
|
| namespace {
|
|
|
| // Distance in pixels that the cursor must move past an edge for a window
|
| @@ -368,7 +389,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
|
| @@ -424,6 +445,10 @@ aura::Window* WorkspaceWindowResizer::GetTarget() {
|
| return details_.window;
|
| }
|
|
|
| +const gfx::Point& WorkspaceWindowResizer::GetInitialLocationForTest() const {
|
| + return details_.initial_location_in_parent;
|
| +}
|
| +
|
| WorkspaceWindowResizer::WorkspaceWindowResizer(
|
| const Details& details,
|
| const std::vector<aura::Window*>& attached_windows)
|
| @@ -850,4 +875,14 @@ WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType(
|
| }
|
|
|
| } // namespace internal
|
| +
|
| +scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
|
| + const gfx::Point& point_in_parent,
|
| + int window_component) {
|
| + return internal::CreateWindowResizerExposeDragResizer(window,
|
| + point_in_parent,
|
| + window_component,
|
| + NULL);
|
| +}
|
| +
|
| } // namespace ash
|
|
|