summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:04:19 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:04:19 +0000
commit46624bf3698811107781e6e6fbaf80622a3f77e8 (patch)
treef060d5f5cb71efe96ff8250225896c96ce646540
parent77c4f1f19f14c1a6f2c136d0ccb242afbfd6b7c4 (diff)
downloadchromium_src-46624bf3698811107781e6e6fbaf80622a3f77e8.zip
chromium_src-46624bf3698811107781e6e6fbaf80622a3f77e8.tar.gz
chromium_src-46624bf3698811107781e6e6fbaf80622a3f77e8.tar.bz2
Don't allow drop to panels (pop-ups) in ChromeOS.
BUG=chromium-os:2413 TEST=Verify fix for chromium-os:2413. Review URL: http://codereview.chromium.org/2779004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49257 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc10
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.cc6
3 files changed, 17 insertions, 2 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 15206a5..2fd0504 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1370,6 +1370,16 @@ void TabContents::OnCloseStarted() {
tab_close_start_time_ = base::TimeTicks::Now();
}
+bool TabContents::ShouldAcceptDragAndDrop() const {
+#if defined(OS_CHROMEOS)
+ // ChromeOS panels (pop-ups) do not take drag-n-drop.
+ // See http://crosbug.com/2413
+ return delegate() && !delegate()->IsPopup(const_cast<TabContents*>(this));
+#else
+ return true;
+#endif
+}
+
TabContents* TabContents::CloneAndMakePhantom() {
TabNavigation tab_nav;
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 5d49107..42c409b 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -667,6 +667,9 @@ class TabContents : public PageNavigator,
return language_state_;
}
+ // Returns true if underlying TabContentsView should accept drag-n-drop.
+ bool ShouldAcceptDragAndDrop() const;
+
// Creates a duplicate of this TabContents. The returned TabContents is
// configured such that the renderer has not been loaded (it'll load the first
// time it is selected).
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
index d6fd5db..55f2a32 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
@@ -189,7 +189,8 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
GDK_POINTER_MOTION_MASK);
// Renderer target DnD.
- drag_dest_.reset(new WebDragDestGtk(tab_contents(), view->native_view()));
+ if (tab_contents()->ShouldAcceptDragAndDrop())
+ drag_dest_.reset(new WebDragDestGtk(tab_contents(), view->native_view()));
gtk_fixed_put(GTK_FIXED(GetNativeView()), view->native_view(), 0, 0);
return view;
@@ -320,7 +321,8 @@ void TabContentsViewGtk::RestoreFocus() {
}
void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) {
- drag_dest_->UpdateDragStatus(operation);
+ if (drag_dest_.get())
+ drag_dest_->UpdateDragStatus(operation);
}
void TabContentsViewGtk::GotFocus() {