Chromium Code Reviews| Index: ash/wm/panels/panel_window_resizer.cc |
| diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc |
| index e306f29411bcc3ba85c4bc4ef58639947c21a03c..a35288d4abd5eef0646c7bb08270d1906c488e21 100644 |
| --- a/ash/wm/panels/panel_window_resizer.cc |
| +++ b/ash/wm/panels/panel_window_resizer.cc |
| @@ -12,7 +12,9 @@ |
| #include "ash/shell_window_ids.h" |
| #include "ash/wm/panels/panel_layout_manager.h" |
| #include "ash/wm/property_util.h" |
| +#include "ash/wm/toplevel_window_event_handler.h" |
| #include "ash/wm/window_properties.h" |
| +#include "ash/wm/window_resizer_owner.h" |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/env.h" |
| #include "ui/aura/root_window.h" |
| @@ -35,11 +37,12 @@ PanelWindowResizer::~PanelWindowResizer() { |
| // static |
| PanelWindowResizer* |
| -PanelWindowResizer::Create(aura::Window* window, |
| - const gfx::Point& location, |
| - int window_component) { |
| +PanelWindowResizer::Create(WindowResizerOwner* owner, |
| + aura::Window* window, |
| + const gfx::Point& location, |
| + int window_component) { |
| Details details(window, location, window_component); |
| - return details.is_resizable ? new PanelWindowResizer(details) : NULL; |
| + return details.is_resizable ? new PanelWindowResizer(owner, details) : NULL; |
| } |
| void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| @@ -57,7 +60,8 @@ void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| } |
| void PanelWindowResizer::CompleteDrag(int event_flags) { |
| - if (should_attach_ != was_attached_) { |
| + if (details_.window->GetProperty(internal::kPanelAttachedKey) != |
| + should_attach_) { |
| details_.window->SetProperty(internal::kPanelAttachedKey, should_attach_); |
| details_.window->SetDefaultParentByRootWindow( |
| details_.window->GetRootWindow(), |
| @@ -81,8 +85,10 @@ aura::Window* PanelWindowResizer::GetTarget() { |
| return details_.window; |
| } |
| -PanelWindowResizer::PanelWindowResizer(const Details& details) |
| - : details_(details), |
| +PanelWindowResizer::PanelWindowResizer(WindowResizerOwner* owner, |
| + const Details& details) |
| + : owner_(owner), |
| + details_(details), |
| panel_container_(NULL), |
| panel_layout_manager_(NULL), |
| did_move_or_resize_(false), |
| @@ -140,13 +146,29 @@ bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) { |
| } |
| void PanelWindowResizer::StartedDragging() { |
| - if (was_attached_) |
| - panel_layout_manager_->StartDragging(details_.window); |
| + // Tell the panel layout manager that we are dragging this panel before |
| + // attaching it so that it does not get repositioned. |
| + panel_layout_manager_->StartDragging(details_.window); |
| + if (!was_attached_) { |
| + // Attach the panel while dragging placing it in front of other panels. |
| + details_.window->SetProperty(internal::kPanelAttachedKey, true); |
| + details_.window->SetDefaultParentByRootWindow( |
| + details_.window->GetRootWindow(), |
| + details_.window->bounds()); |
| + |
| + if (owner_) { |
| + ash::internal::RootWindowController* root_window_controller = |
| + GetRootWindowController(details_.window->GetRootWindow()); |
| + WindowResizerOwner* new_owner = |
| + root_window_controller->panel_container_handler(); |
|
flackr
2013/03/13 19:20:26
Right now there's no way to get the drag/resize ha
|
| + owner_->PassResizer(new_owner); |
| + owner_ = new_owner; |
| + } |
| + } |
| } |
| void PanelWindowResizer::FinishDragging() { |
| - if (was_attached_) |
| - panel_layout_manager_->FinishDragging(); |
| + panel_layout_manager_->FinishDragging(); |
| } |
| } // namespace aura |