Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc

Issue 7377003: Add support for text/html to bookmarks gtk drag/drop. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add memory leak fix to test Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc
index 4da5a629c7dabcea8af65a4d2c6bd517e09efee5..53cd58a136297790a0c6c85e1194ac5a0859130b 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc
@@ -290,6 +290,7 @@ int GetCodeMask(bool folder) {
int rv = ui::CHROME_BOOKMARK_ITEM;
if (!folder) {
rv |= ui::TEXT_URI_LIST |
+ ui::TEXT_HTML |
ui::TEXT_PLAIN |
ui::NETSCAPE_URL;
}
@@ -351,6 +352,18 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes,
free(uris);
break;
}
+ case ui::TEXT_HTML: {
+ std::string utf8_title = UTF16ToUTF8(nodes[0]->GetTitle());
+ std::string utf8_html = StringPrintf("<a href=\"%s\">%s</a>",
+ nodes[0]->GetURL().spec().c_str(),
+ utf8_title.c_str());
+ gtk_selection_data_set(selection_data,
+ GetAtomForTarget(ui::TEXT_HTML),
+ kBitsInAByte,
+ reinterpret_cast<const guchar*>(utf8_html.data()),
+ utf8_html.size());
+ break;
+ }
case ui::TEXT_PLAIN: {
gtk_selection_data_set_text(selection_data,
nodes[0]->GetURL().spec().c_str(), -1);
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698