diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
commit | 1d9f4137eff50f1305e288767bb770151526552d (patch) | |
tree | 4ae1750d34778e7b0ae23dfe315118cf124c3715 /chrome/browser/gtk | |
parent | c7f475ed4a9fd8f198468df696c55e1c75d65526 (diff) | |
download | chromium_src-1d9f4137eff50f1305e288767bb770151526552d.zip chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.gz chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.bz2 |
Plumb the DragOperation through all the layers between the platform Drag-n-drop code and WebCore.
This allows the HTML5 DataTransfer effectAllowed and dropEffect properties to be set correctly in JS handlers, as per the HTML5 spec.
(The drag-dropeffect test isn't in WebKit yet -- it's part of a separate WebKit patch that's been in review for weeks.)
R=darin,pink
BUG=http://code.google.com/p/chromium/issues/detail?id=14654, http://code.google.com/p/chromium/issues/detail?id=20985
TEST=LayoutTests/fast/events/drag-dropeffect.html, LayoutTests/editing/pasteboard/files-during-page-drags.html
Review URL: http://codereview.chromium.org/174364
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/tab_contents_drag_source.cc | 12 | ||||
-rw-r--r-- | chrome/browser/gtk/tab_contents_drag_source.h | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/gtk/tab_contents_drag_source.cc b/chrome/browser/gtk/tab_contents_drag_source.cc index 780c6ca..146cbd7 100644 --- a/chrome/browser/gtk/tab_contents_drag_source.cc +++ b/chrome/browser/gtk/tab_contents_drag_source.cc @@ -12,6 +12,9 @@ #include "chrome/common/gtk_util.h" #include "webkit/glue/webdropdata.h" +using WebKit::WebDragOperation; +using WebKit::WebDragOperationNone; + TabContentsDragSource::TabContentsDragSource( TabContentsView* tab_contents_view) : tab_contents_view_(tab_contents_view), @@ -170,15 +173,16 @@ gboolean TabContentsDragSource::OnDragFailed() { gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); if (tab_contents()->render_view_host()) { - tab_contents()->render_view_host()->DragSourceCancelledAt( - client.x(), client.y(), root.x(), root.y()); + tab_contents()->render_view_host()->DragSourceEndedAt( + client.x(), client.y(), root.x(), root.y(), + WebDragOperationNone); } // Let the native failure animation run. return FALSE; } -void TabContentsDragSource::OnDragEnd() { +void TabContentsDragSource::OnDragEnd(WebDragOperation operation) { MessageLoopForUI::current()->RemoveObserver(this); if (!drag_failed_) { @@ -187,7 +191,7 @@ void TabContentsDragSource::OnDragEnd() { if (tab_contents()->render_view_host()) { tab_contents()->render_view_host()->DragSourceEndedAt( - client.x(), client.y(), root.x(), root.y()); + client.x(), client.y(), root.x(), root.y(), operation); } } diff --git a/chrome/browser/gtk/tab_contents_drag_source.h b/chrome/browser/gtk/tab_contents_drag_source.h index 1d35669..1df7df8 100644 --- a/chrome/browser/gtk/tab_contents_drag_source.h +++ b/chrome/browser/gtk/tab_contents_drag_source.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/gfx/native_widget_types.h" #include "base/message_loop.h" +#include "webkit/api/public/WebDragOperation.h" class TabContents; class TabContentsView; @@ -44,9 +45,10 @@ class TabContentsDragSource : public MessageLoopForUI::Observer { static void OnDragEndThunk(GtkWidget* widget, GdkDragContext* drag_context, TabContentsDragSource* handler) { - handler->OnDragEnd(); + handler->OnDragEnd(WebKit::WebDragOperationCopy); + // TODO(snej): Pass actual operation instead of hardcoding copy } - void OnDragEnd(); + void OnDragEnd(WebKit::WebDragOperation operation); static void OnDragDataGetThunk(GtkWidget* drag_widget, GdkDragContext* context, GtkSelectionData* selection_data, |