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

Unified Diff: app/gtk_dnd_util.cc

Issue 5292013: GTK: Parse NETSCAPE_URL types in drags to the bookmark bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 | « app/gtk_dnd_util.h ('k') | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gtk_dnd_util.cc
diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc
index 92797a68ae1072497a276b3b99a85631af7f20dc..5df8151c243248304a2bad49341ff362ca080b65 100644
--- a/app/gtk_dnd_util.cc
+++ b/app/gtk_dnd_util.cc
@@ -237,4 +237,27 @@ bool ExtractURIList(GtkSelectionData* selection_data, std::vector<GURL>* urls) {
return true;
}
+bool ExtractNetscapeURL(GtkSelectionData* selection_data,
+ GURL* url,
+ string16* title) {
+ if (!selection_data || selection_data->length <= 0)
+ return false;
+
+ // Find the first '\n' in the data. It is the separator between the url and
+ // the title.
+ std::string data(reinterpret_cast<char*>(selection_data->data),
+ selection_data->length);
+ std::string::size_type newline = data.find('\n');
+ if (newline == std::string::npos)
+ return false;
+
+ GURL gurl(data.substr(0, newline));
+ if (!gurl.is_valid())
+ return false;
+
+ *url = gurl;
Evan Stade 2010/11/30 23:56:17 if (url) ... if (title) ...
Elliot Glaysher 2010/12/01 00:05:21 ExtractNamedURL() and ExtractURIList() don't check
+ *title = UTF8ToUTF16(data.substr(newline + 1));
+ return true;
+}
+
} // namespace gtk_dnd_util
« no previous file with comments | « app/gtk_dnd_util.h ('k') | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698