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

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

Issue 159419: Correctly update drag status for drags over renderer. This makes things look ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do what Brett says Created 11 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
Index: chrome/browser/gtk/bookmark_utils_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_utils_gtk.cc (revision 21718)
+++ chrome/browser/gtk/bookmark_utils_gtk.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_drag_data.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/gtk/gtk_chrome_button.h"
#include "chrome/browser/gtk/gtk_dnd_util.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
@@ -209,7 +210,7 @@
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.
+ // little testing, it seems fine.
const GURL& url = nodes[i]->GetURL();
// This const cast should be safe as gtk_selection_data_set_uris()
// makes copies.
@@ -268,9 +269,31 @@
std::string title_utf8, url_utf8;
bool rv = data.ReadString(&iter, &title_utf8);
rv = rv && data.ReadString(&iter, &url_utf8);
- if (rv)
- model->AddURL(parent, idx, UTF8ToWide(title_utf8), GURL(url_utf8));
+ if (rv) {
+ GURL url(url_utf8);
+ if (title_utf8.empty())
+ title_utf8 = GetNameForURL(url);
+ model->AddURL(parent, idx, UTF8ToWide(title_utf8), url);
+ }
return rv;
}
+bool CreateNewBookmarksFromURIList(GtkSelectionData* selection_data,
+ BookmarkModel* model, const BookmarkNode* parent, int idx) {
+ gchar** uris = gtk_selection_data_get_uris(selection_data);
+ if (!uris) {
+ NOTREACHED();
+ return false;
+ }
+
+ for (size_t i = 0; uris[i] != NULL; ++i) {
+ GURL url(uris[i]);
+ std::string title = GetNameForURL(url);
+ model->AddURL(parent, idx++, UTF8ToWide(title), url);
+ }
+
+ g_strfreev(uris);
+ return true;
+}
+
} // namespace bookmark_utils

Powered by Google App Engine
This is Rietveld 408576698