diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 00:36:58 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 00:36:58 +0000 |
commit | 8ada5e06e95dd941314a0665da2948448fefa820 (patch) | |
tree | a76c5f54eaf16c29f595af2b76d5e5c2e0327b07 /app | |
parent | 595d56c647fc96cc9b6a5b8ec5b4787e719f981c (diff) | |
download | chromium_src-8ada5e06e95dd941314a0665da2948448fefa820.zip chromium_src-8ada5e06e95dd941314a0665da2948448fefa820.tar.gz chromium_src-8ada5e06e95dd941314a0665da2948448fefa820.tar.bz2 |
Support dragging a virtual file out of the browser on Linux. This is based on the discussion of drag-out feature on whatwg: http://list.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-August/022122.html
BUG=none
TEST=To test, drag an element that adds the DownloadURL format data via event.DataTransfer.setData, to the desktop or a folder.
Review URL: http://codereview.chromium.org/600154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gtk_dnd_util.cc | 17 | ||||
-rw-r--r-- | app/gtk_dnd_util.h | 6 |
2 files changed, 21 insertions, 2 deletions
diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc index fb2f492..32c5150 100644 --- a/app/gtk_dnd_util.cc +++ b/app/gtk_dnd_util.cc @@ -49,6 +49,16 @@ GdkAtom GtkDndUtil::GetAtomForTarget(int target) { const_cast<char*>("_NETSCAPE_URL"), false); return netscape_url; + case TEXT_PLAIN_NO_CHARSET: + static GdkAtom text_no_charset_atom = gdk_atom_intern( + const_cast<char*>("text/plain"), false); + return text_no_charset_atom; + + case DIRECT_SAVE_FILE: + static GdkAtom xds_atom = gdk_atom_intern( + const_cast<char*>("XdndDirectSave0"), false); + return xds_atom; + default: NOTREACHED(); } @@ -114,10 +124,15 @@ void GtkDndUtil::AddTargetToList(GtkTargetList* targets, int target_code) { case CHROME_TAB: case CHROME_BOOKMARK_ITEM: case CHROME_NAMED_URL: - gtk_target_list_add(targets, GtkDndUtil::GetAtomForTarget(target_code), + gtk_target_list_add(targets, GetAtomForTarget(target_code), GTK_TARGET_SAME_APP, target_code); break; + case DIRECT_SAVE_FILE: + gtk_target_list_add(targets, GetAtomForTarget(DIRECT_SAVE_FILE), 0, + DIRECT_SAVE_FILE); + break; + default: NOTREACHED() << " Unexpected target code: " << target_code; } diff --git a/app/gtk_dnd_util.h b/app/gtk_dnd_util.h index 4b6155e..efa249c 100644 --- a/app/gtk_dnd_util.h +++ b/app/gtk_dnd_util.h @@ -31,7 +31,11 @@ class GtkDndUtil { // apps. NETSCAPE_URL = 1 << 7, - INVALID_TARGET = 1 << 8, + // Used for drag-out download. + TEXT_PLAIN_NO_CHARSET = 1 << 8, + DIRECT_SAVE_FILE = 1 << 9, + + INVALID_TARGET = 1 << 10, }; // Get the atom for a given target (of the above enum type). Will return NULL |