diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 01:01:53 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 01:01:53 +0000 |
commit | 3f873e1cd9bc39d4eb8c40e6ee68e7dd6af68aae (patch) | |
tree | c621c73bfd4e502574583cad8ecac23c486eae3e /chrome/browser/gtk/bookmark_utils_gtk.cc | |
parent | d0e7a1430e0fe39134acdfd12cf6e4d84511ca8d (diff) | |
download | chromium_src-3f873e1cd9bc39d4eb8c40e6ee68e7dd6af68aae.zip chromium_src-3f873e1cd9bc39d4eb8c40e6ee68e7dd6af68aae.tar.gz chromium_src-3f873e1cd9bc39d4eb8c40e6ee68e7dd6af68aae.tar.bz2 |
Gtk: URI list dragging for bookmarks (source side only)
BUG=none
TEST=drag a bookmark into the webview or onto another program such as konqueror. The right thing should happen.
Review URL: http://codereview.chromium.org/149301
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_utils_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/bookmark_utils_gtk.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/gtk/bookmark_utils_gtk.cc index 81bea90..9e6f948 100644 --- a/chrome/browser/gtk/bookmark_utils_gtk.cc +++ b/chrome/browser/gtk/bookmark_utils_gtk.cc @@ -190,6 +190,24 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, pickle.size()); break; } + case GtkDndUtil::X_CHROME_TEXT_URI_LIST: { + gchar** uris = reinterpret_cast<gchar**>(malloc(sizeof(gchar*) * + (nodes.size() + 1))); + for (size_t i = 0; i < nodes.size(); ++i) { + // If the node is a folder, this will be empty. TODO(estade): figure out + // if there are any ramifications to passing an empty URI. After a + // lttle testing, it seems fine. + const GURL& url = nodes[i]->GetURL(); + // This const cast should be safe as gtk_selection_data_set_uris() + // makes copies. + uris[i] = const_cast<gchar*>(url.spec().c_str()); + } + uris[nodes.size()] = NULL; + + gtk_selection_data_set_uris(selection_data, uris); + free(uris); + break; + } default: { DLOG(ERROR) << "Unsupported drag get type!"; } |