Commit 9dc4eb0f authored by avi@chromium.org's avatar avi@chromium.org

Tweak the WebDragDestDelegate to be useful for more than GTK.

BUG=95573
TEST=no visible change

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107985

Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=107990

Review URL: http://codereview.chromium.org/8429005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107996 0039d316-1c4b-4281-b951-d872f2087c98
parent 51a2dc01
......@@ -6,28 +6,29 @@
#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_GTK_H_
#pragma once
#include "base/compiler_specific.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "content/browser/tab_contents/web_drag_dest_delegate_gtk.h"
#include "content/browser/tab_contents/web_drag_dest_delegate.h"
class TabContentsWrapper;
// Chrome needs to intercept content drag events so it can dispatch them to the
// bookmarks and extensions system.
class WebDragBookmarkHandlerGtk : public content::WebDragDestDelegateGtk {
class WebDragBookmarkHandlerGtk : public content::WebDragDestDelegate {
public:
WebDragBookmarkHandlerGtk();
virtual ~WebDragBookmarkHandlerGtk();
// Overridden from WebDragBookmarkDelegate:
virtual void DragInitialize(TabContents* contents);
virtual GdkAtom GetBookmarkTargetAtom() const;
virtual void OnReceiveDataFromGtk(GtkSelectionData* data);
virtual void DragInitialize(TabContents* contents) OVERRIDE;
virtual GdkAtom GetBookmarkTargetAtom() const OVERRIDE;
virtual void OnReceiveDataFromGtk(GtkSelectionData* data) OVERRIDE;
virtual void OnReceiveProcessedData(const GURL& url,
const string16& title);
virtual void OnDragOver();
virtual void OnDragEnter();
virtual void OnDrop();
virtual void OnDragLeave();
const string16& title) OVERRIDE;
virtual void OnDragOver() OVERRIDE;
virtual void OnDragEnter() OVERRIDE;
virtual void OnDrop() OVERRIDE;
virtual void OnDragLeave() OVERRIDE;
private:
// The TabContentsWrapper for |tab_contents_|.
......
......@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_GTK_H_
#define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_GTK_H_
#ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_H_
#define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_H_
#pragma once
#if defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h>
#endif // TOOLKIT_USES_GTK
#include "base/string16.h"
#include "content/common/content_export.h"
......@@ -17,13 +19,19 @@ class TabContents;
namespace content {
// An optional delegate that listens for drags of bookmark data.
class CONTENT_EXPORT WebDragDestDelegateGtk {
class CONTENT_EXPORT WebDragDestDelegate {
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;
// Notifications of drag progression.
virtual void OnDragOver() = 0;
virtual void OnDragEnter() = 0;
virtual void OnDrop() = 0;
#if defined(TOOLKIT_USES_GTK)
// Returns the bookmark atom type. GTK and Views return different values here.
virtual GdkAtom GetBookmarkTargetAtom() const = 0;
......@@ -32,18 +40,14 @@ class CONTENT_EXPORT WebDragDestDelegateGtk {
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;
#endif // TOOLKIT_USES_GTK
// This should also clear any state kept about this drag.
virtual void OnDragLeave() = 0;
virtual ~WebDragDestDelegateGtk() {}
virtual ~WebDragDestDelegate() {}
};
} // namespace content
#endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_GTK_H_
#endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_DELEGATE_H_
......@@ -12,7 +12,7 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/drag_utils_gtk.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/web_drag_dest_delegate_gtk.h"
#include "content/browser/tab_contents/web_drag_dest_delegate.h"
#include "content/public/common/url_constants.h"
#include "net/base/net_util.h"
#include "ui/base/dragdrop/gtk_dnd_util.h"
......
......@@ -20,7 +20,7 @@ class TabContents;
namespace content {
class WebDragDestDelegateGtk;
class WebDragDestDelegate;
// A helper class that handles DnD for drops in the renderer. In GTK parlance,
// this handles destination-side DnD, but not source-side DnD.
......@@ -37,8 +37,8 @@ class CONTENT_EXPORT WebDragDestGtk {
// See OnDragLeave().
void DragLeave();
WebDragDestDelegateGtk* delegate() const { return delegate_; }
void set_delegate(WebDragDestDelegateGtk* delegate) { delegate_ = delegate; }
WebDragDestDelegate* delegate() const { return delegate_; }
void set_delegate(WebDragDestDelegate* delegate) { delegate_ = delegate; }
private:
// Called when a system drag crosses over the render view. As there is no drag
......@@ -94,7 +94,7 @@ class CONTENT_EXPORT WebDragDestGtk {
int destroy_handler_;
// A delegate that can receive drag information about drag events.
WebDragDestDelegateGtk* delegate_;
WebDragDestDelegate* delegate_;
ScopedRunnableMethodFactory<WebDragDestGtk> method_factory_;
......
......@@ -538,7 +538,7 @@
'browser/tab_contents/tab_contents_view.cc',
'browser/tab_contents/tab_contents_view.h',
'browser/tab_contents/title_updated_details.h',
'browser/tab_contents/web_drag_dest_delegate_gtk.h',
'browser/tab_contents/web_drag_dest_delegate.h',
'browser/tab_contents/web_drag_dest_gtk.cc',
'browser/tab_contents/web_drag_dest_gtk.h',
'browser/tab_contents/web_drag_source_gtk.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment