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

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

Issue 1029004: GTK: implement extension bookmark manager drag api.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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/tab_contents/web_drag_dest_gtk.h ('k') | chrome/browser/tab_contents/web_drop_target_win.cc » ('j') | 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
===================================================================
--- chrome/browser/tab_contents/web_drag_dest_gtk.cc (revision 41880)
+++ chrome/browser/tab_contents/web_drag_dest_gtk.cc (working copy)
@@ -9,6 +9,7 @@
#include "app/gtk_dnd_util.h"
#include "base/file_path.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/gtk/bookmark_utils_gtk.h"
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -60,6 +61,10 @@
void WebDragDestGtk::DragLeave() {
tab_contents_->render_view_host()->DragTargetDragLeave();
+
+ if (tab_contents_->GetBookmarkDragDelegate()) {
+ tab_contents_->GetBookmarkDragDelegate()->OnDragLeave(bookmark_drag_data_);
+ }
}
gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender,
@@ -77,6 +82,7 @@
gtk_dnd_util::TEXT_HTML,
gtk_dnd_util::NETSCAPE_URL,
gtk_dnd_util::CHROME_NAMED_URL,
+ gtk_dnd_util::CHROME_BOOKMARK_ITEM,
// TODO(estade): support image drags?
};
@@ -87,12 +93,14 @@
time);
}
} else if (data_requests_ == 0) {
+ // TODO(snej): Pass appropriate DragOperation instead of hardcoding
tab_contents_->render_view_host()->
DragTargetDragOver(gtk_util::ClientPoint(widget_),
gtk_util::ScreenPoint(widget_),
static_cast<WebDragOperation>(
WebDragOperationCopy | WebDragOperationMove));
- // TODO(snej): Pass appropriate DragOperation instead of hardcoding
+ if (tab_contents_->GetBookmarkDragDelegate())
+ tab_contents_->GetBookmarkDragDelegate()->OnDragOver(bookmark_drag_data_);
drag_over_time_ = time;
}
@@ -160,19 +168,36 @@
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)) {
+ 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());
}
}
if (data_requests_ == 0) {
// Tell the renderer about the drag.
// |x| and |y| are seemingly arbitrary at this point.
+ // TODO(snej): Pass appropriate DragOperation instead of hardcoding.
tab_contents_->render_view_host()->
DragTargetDragEnter(*drop_data_.get(),
gtk_util::ClientPoint(widget_),
gtk_util::ScreenPoint(widget_),
static_cast<WebDragOperation>(
WebDragOperationCopy | WebDragOperationMove));
- // TODO(snej): Pass appropriate DragOperation instead of hardcoding
+
+ // This is non-null if tab_contents_ is showing an ExtensionDOMUI with
+ // support for (at the moment experimental) drag and drop extensions.
+ if (tab_contents_->GetBookmarkDragDelegate()) {
+ tab_contents_->GetBookmarkDragDelegate()->OnDragEnter(
+ bookmark_drag_data_);
+ }
+
drag_over_time_ = time;
}
}
@@ -202,6 +227,11 @@
DragTargetDrop(gtk_util::ClientPoint(widget_),
gtk_util::ScreenPoint(widget_));
+ // This is non-null if tab_contents_ is showing an ExtensionDOMUI with
+ // support for (at the moment experimental) drag and drop extensions.
+ if (tab_contents_->GetBookmarkDragDelegate())
+ tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data_);
+
// The second parameter is just an educated guess, but at least we will
// get the drag-end animation right sometimes.
gtk_drag_finish(context, is_drop_target_, FALSE, time);
« no previous file with comments | « chrome/browser/tab_contents/web_drag_dest_gtk.h ('k') | chrome/browser/tab_contents/web_drop_target_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698