summaryrefslogtreecommitdiffstats
path: root/app/gtk_dnd_util.cc
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 23:58:16 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 23:58:16 +0000
commita9a6845cde454dd50e65cbeb1a4883d2f95bb936 (patch)
treeb53f07d7c759c7e4abd04a551560c961aefd71bc /app/gtk_dnd_util.cc
parentdd8fa1a9964a4b68eea27675be52a8aceda3af0f (diff)
downloadchromium_src-a9a6845cde454dd50e65cbeb1a4883d2f95bb936.zip
chromium_src-a9a6845cde454dd50e65cbeb1a4883d2f95bb936.tar.gz
chromium_src-a9a6845cde454dd50e65cbeb1a4883d2f95bb936.tar.bz2
GTK plumbing for dragend.
This plumbs the actual dropEffect that occurred back into WebKit so that dragend is dispatched with the correct dropEffect. BUG=39399 TEST=Manual testing using the attached test case on the bug. Review URL: http://codereview.chromium.org/1589015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gtk_dnd_util.cc')
-rw-r--r--app/gtk_dnd_util.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc
index d6b0903..43c48bd0 100644
--- a/app/gtk_dnd_util.cc
+++ b/app/gtk_dnd_util.cc
@@ -11,6 +11,13 @@
static const int kBitsPerByte = 8;
+using WebKit::WebDragOperationsMask;
+using WebKit::WebDragOperation;
+using WebKit::WebDragOperationNone;
+using WebKit::WebDragOperationCopy;
+using WebKit::WebDragOperationLink;
+using WebKit::WebDragOperationMove;
+
namespace {
void AddTargetToList(GtkTargetList* targets, int target_code) {
@@ -226,15 +233,26 @@ bool ExtractURIList(GtkSelectionData* selection_data, std::vector<GURL>* urls) {
return true;
}
-GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op) {
+GdkDragAction WebDragOpToGdkDragAction(WebDragOperationsMask op) {
GdkDragAction action = static_cast<GdkDragAction>(0);
- if (op & WebKit::WebDragOperationCopy)
+ if (op & WebDragOperationCopy)
action = static_cast<GdkDragAction>(action | GDK_ACTION_COPY);
- if (op & WebKit::WebDragOperationLink)
+ if (op & WebDragOperationLink)
action = static_cast<GdkDragAction>(action | GDK_ACTION_LINK);
- if (op & WebKit::WebDragOperationMove)
+ if (op & WebDragOperationMove)
action = static_cast<GdkDragAction>(action | GDK_ACTION_MOVE);
return action;
}
+WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action) {
+ WebDragOperationsMask op = WebDragOperationNone;
+ if (action & GDK_ACTION_COPY)
+ op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy);
+ if (action & GDK_ACTION_LINK)
+ op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink);
+ if (action & GDK_ACTION_MOVE)
+ op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove);
+ return op;
+}
+
} // namespace gtk_dnd_util