diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 01:27:13 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 01:27:13 +0000 |
commit | c114d071107fd3997bb1feb66767156f9b85f84d (patch) | |
tree | 75997b4cb378933b109193e69ff16e51e129dff0 /app | |
parent | 46fc912073cc67de0e21ac4e3bc7db33980d2376 (diff) | |
download | chromium_src-c114d071107fd3997bb1feb66767156f9b85f84d.zip chromium_src-c114d071107fd3997bb1feb66767156f9b85f84d.tar.gz chromium_src-c114d071107fd3997bb1feb66767156f9b85f84d.tar.bz2 |
Allow link drags from Chrome to create a shortcut on the desktop.
This required adding the netscape link+title format to the drag data
(we were already doing this on windows) and adding GDK_ACTION_LINK
to the GdkDragAction passed into gtk_drag_begin.
BUG=27337
TEST=Drag a link to the desktop, it should create a shortcut (.desktop file).
Review URL: http://codereview.chromium.org/542072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gtk_dnd_util.cc | 10 | ||||
-rw-r--r-- | app/gtk_dnd_util.h | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc index a7933ab..da4362dc 100644 --- a/app/gtk_dnd_util.cc +++ b/app/gtk_dnd_util.cc @@ -44,6 +44,11 @@ GdkAtom GtkDndUtil::GetAtomForTarget(int target) { const_cast<char*>("application/x-chrome-named-url"), false); return named_url; + case NETSCAPE_URL: + static GdkAtom netscape_url = gdk_atom_intern( + const_cast<char*>("_NETSCAPE_URL"), false); + return netscape_url; + default: NOTREACHED(); } @@ -101,6 +106,11 @@ void GtkDndUtil::AddTargetToList(GtkTargetList* targets, int target_code) { gtk_target_list_add(targets, GetAtomForTarget(TEXT_PLAIN), 0, TEXT_HTML); break; + case NETSCAPE_URL: + gtk_target_list_add(targets, GetAtomForTarget(NETSCAPE_URL), 0, + NETSCAPE_URL); + break; + case CHROME_TAB: case CHROME_BOOKMARK_ITEM: case CHROME_NAMED_URL: diff --git a/app/gtk_dnd_util.h b/app/gtk_dnd_util.h index 7365cec..4b6155e 100644 --- a/app/gtk_dnd_util.h +++ b/app/gtk_dnd_util.h @@ -27,7 +27,11 @@ class GtkDndUtil { TEXT_URI_LIST = 1 << 5, TEXT_HTML = 1 << 6, - INVALID_TARGET = 1 << 7, + // Other types. NETSCAPE_URL is provided for compatibility with other + // apps. + NETSCAPE_URL = 1 << 7, + + INVALID_TARGET = 1 << 8, }; // Get the atom for a given target (of the above enum type). Will return NULL |