Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2677)

Unified Diff: ash/wm/panels/panel_window_resizer.cc

Issue 12441010: Attach panel while dragging to bring it in front of other panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments, etc. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+ owner_->PassResizer(new_owner);
+ owner_ = new_owner;
+ }
+ }
}
void PanelWindowResizer::FinishDragging() {
- if (was_attached_)
- panel_layout_manager_->FinishDragging();
+ panel_layout_manager_->FinishDragging();
}
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698