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

Unified Diff: chrome/browser/tab_contents/web_drag_dest_gtk.cc

Issue 1691018: GTK: make tabbed bookmark manager compatible with more types of drops. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: naming Created 10 years, 8 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 | « chrome/browser/bookmarks/bookmark_drag_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/web_drag_dest_gtk.cc
diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
index 0fd6caa0442186a43f03b97521761f22887c58ad..bc07971c2fcc7a59095d87d9e99c901a3cf0e0d4 100644
--- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc
+++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
@@ -73,6 +73,7 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender,
if (context_ != context) {
context_ = context;
drop_data_.reset(new WebDropData);
+ bookmark_drag_data_.Clear();
is_drop_target_ = false;
static int supported_targets[] = {
@@ -158,23 +159,32 @@ void WebDragDestGtk::OnDragDataReceived(
data->length);
size_t split = netscape_url.find_first_of('\n');
if (split != std::string::npos) {
- drop_data_->url_title = UTF8ToUTF16(netscape_url.substr(0, split));
+ drop_data_->url = GURL(netscape_url.substr(0, split));
if (split < netscape_url.size() - 1)
- drop_data_->url = GURL(netscape_url.substr(split + 1));
+ drop_data_->url_title = UTF8ToUTF16(netscape_url.substr(split + 1));
}
} else if (data->target ==
gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_NAMED_URL)) {
gtk_dnd_util::ExtractNamedURL(data,
&drop_data_->url, &drop_data_->url_title);
- } else if (data->target ==
- gtk_dnd_util::GetAtomForTarget(
- gtk_dnd_util::CHROME_BOOKMARK_ITEM)) {
+ }
+ }
+
+ // For CHROME_BOOKMARK_ITEM, we have to handle the case where the drag source
+ // doesn't have any data available for us. In this case we try to synthesize a
+ // URL bookmark.
+ if (data->target ==
+ gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_BOOKMARK_ITEM)) {
+ if (data->data) {
bookmark_drag_data_.ReadFromVector(
bookmark_utils::GetNodesFromSelection(
NULL, data,
gtk_dnd_util::CHROME_BOOKMARK_ITEM,
tab_contents_->profile(), NULL, NULL));
bookmark_drag_data_.SetOriginatingProfile(tab_contents_->profile());
+ } else {
+ bookmark_drag_data_.ReadFromTuple(drop_data_->url,
+ drop_data_->url_title);
}
}
« no previous file with comments | « chrome/browser/bookmarks/bookmark_drag_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698