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

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

Issue 17431003: Dragging panels near screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dragging panels near screen edge (comments) Created 7 years, 6 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
« no previous file with comments | « ash/wm/panels/panel_layout_manager.h ('k') | ash/wm/panels/panel_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/panels/panel_layout_manager.cc
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index c4ccd11a3d878a0cd6728166abfa487147f3bfeb..b8d6077ef5a1d01f5a26c385bb9d7e1cef38b478 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -13,9 +13,11 @@
#include "ash/shelf/shelf_types.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
#include "ash/wm/frame_painter.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/auto_reset.h"
#include "base/bind.h"
@@ -250,6 +252,7 @@ class PanelCalloutWidget : public views::Widget {
// PanelLayoutManager public implementation:
PanelLayoutManager::PanelLayoutManager(aura::Window* panel_container)
: panel_container_(panel_container),
+ in_add_window_(false),
in_layout_(false),
dragged_panel_(NULL),
launcher_(NULL),
@@ -328,6 +331,22 @@ void PanelLayoutManager::OnWindowResized() {
void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (child->type() == aura::client::WINDOW_TYPE_POPUP)
return;
+ if (in_add_window_)
+ return;
+ base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true);
+ if (!child->GetProperty(kPanelAttachedKey)) {
+ // This should only happen when a window is added to panel container as a
+ // result of bounds change from within the application during a drag.
+ // If so we have already stopped the drag and should reparent the panel
+ // back to appropriate container and ignore it.
+ // TODO(varkha): Updating bounds during a drag can cause problems and a more
+ // general solution is needed. See http://crbug.com/251813 .
+ child->SetDefaultParentByRootWindow(
+ child->GetRootWindow(),
+ child->GetRootWindow()->GetBoundsInScreen());
+ DCHECK(child->parent()->id() != kShellWindowId_PanelContainer);
+ return;
+ }
PanelInfo panel_info;
panel_info.window = child;
panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
« no previous file with comments | « ash/wm/panels/panel_layout_manager.h ('k') | ash/wm/panels/panel_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698