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

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

Issue 8196001: content: Split web_drag_dest_gtk.cc into chrome/ and content/ parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: :( Created 9 years, 2 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/tab_contents/web_drag_dest_gtk.h
diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.h b/chrome/browser/tab_contents/web_drag_dest_gtk.h
index 84511971e78645ada1d02c6780f080c419d2ab57..702981532a4c10a9dc8f9971b1b23ed086e7ced2 100644
--- a/chrome/browser/tab_contents/web_drag_dest_gtk.h
+++ b/chrome/browser/tab_contents/web_drag_dest_gtk.h
@@ -11,13 +11,36 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
#include "ui/base/gtk/gtk_signal.h"
#include "webkit/glue/webdropdata.h"
class TabContents;
-class TabContentsWrapper;
+
+// An optional delegate that listens for drags of bookmark data.
+class WebDragBookmarkDelegate {
jam 2011/10/11 01:42:21 nit: this should be in its own file since current
+ public:
+ // Announces that a drag has started. It's valid that a drag starts, along
+ // with over/enter/leave/drop notifications without receiving any bookmark
+ // data.
+ virtual void DragInitialize(TabContents* contents) = 0;
+
+ // Called when WebDragDestkGtk detects that there's bookmark data in a
+ // drag. Not every drag will trigger these.
+ virtual void OnReceiveDataFromGtk(GtkSelectionData* data) = 0;
+ virtual void OnReceiveProcessedData(const GURL& url,
+ const string16& title) = 0;
+
+ // Notifications of drag progression.
+ virtual void OnDragOver() = 0;
+ virtual void OnDragEnter() = 0;
+ virtual void OnDrop() = 0;
+
+ // This should also clear any state kept about this drag.
+ virtual void OnDragLeave() = 0;
+
+ virtual ~WebDragBookmarkDelegate() {}
+};
// A helper class that handles DnD for drops in the renderer. In GTK parlance,
// this handles destination-side DnD, but not source-side DnD.
@@ -34,9 +57,10 @@ class WebDragDestGtk {
// See OnDragLeave().
void DragLeave();
- private:
- FRIEND_TEST_ALL_PREFIXES(WebDragDestGtkTest, NoTabContentsWrapper);
+ WebDragBookmarkDelegate* delegate() const { return delegate_; }
+ void set_delegate(WebDragBookmarkDelegate* delegate) { delegate_ = delegate; }
+ private:
// Called when a system drag crosses over the render view. As there is no drag
// enter event, we treat it as an enter event (and not a regular motion event)
// when |context_| is NULL.
@@ -62,11 +86,6 @@ class WebDragDestGtk {
TabContents* tab_contents_;
- // The TabContentsWrapper for |tab_contents_|.
- // Weak reference; may be NULL if the contents aren't contained in a wrapper
- // (e.g. WebUI dialogs).
- TabContentsWrapper* tab_;
-
// The render view.
GtkWidget* widget_;
@@ -94,9 +113,8 @@ class WebDragDestGtk {
// |widget_| is.
int destroy_handler_;
- // The bookmark data for the current tab. This will be empty if there is not
- // a native bookmark drag (or we haven't gotten the data from the source yet).
- BookmarkNodeData bookmark_drag_data_;
+ // A delegate that can receive drag information about drag events.
+ WebDragBookmarkDelegate* delegate_;
ScopedRunnableMethodFactory<WebDragDestGtk> method_factory_;

Powered by Google App Engine
This is Rietveld 408576698