Chromium Code Reviews| 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 |