summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 15:24:41 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 15:24:41 +0000
commitc27ae599b03a7c30a65c843a8aed99a9e94d284e (patch)
treedd7a3413fbd5d46b3d9e102b2249c817ef2f9b9a
parentb490de133b26e30f8fc5429ff666107cdfdcc117 (diff)
downloadchromium_src-c27ae599b03a7c30a65c843a8aed99a9e94d284e.zip
chromium_src-c27ae599b03a7c30a65c843a8aed99a9e94d284e.tar.gz
chromium_src-c27ae599b03a7c30a65c843a8aed99a9e94d284e.tar.bz2
Retry r41799:
Basic DragImage implementation. Only the chromium part is for review. The webkit part shows how that will look when I create the patch for webkit later. This can be landed without the change to webkit. TODO later: - use the image on windows, mac - implement the other DragImageRef functions TEST=drag an image from the render view in GTK BUG=11457 Review URL: http://codereview.chromium.org/668125 The problem was an incorrect method signature in RenderView. Review URL: http://codereview.chromium.org/1037008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41953 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/app_launcher.cc4
-rw-r--r--chrome/browser/chromeos/app_launcher.h6
-rw-r--r--chrome/browser/cocoa/notifications/balloon_view_host_mac.h8
-rw-r--r--chrome/browser/extensions/extension_host.cc4
-rw-r--r--chrome/browser/extensions/extension_host.h4
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_host_gtk.h4
-rw-r--r--chrome/browser/gtk/tab_contents_drag_source.cc14
-rw-r--r--chrome/browser/gtk/tab_contents_drag_source.h11
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc6
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h5
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc8
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc7
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.h8
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm8
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.h8
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.cc7
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.h8
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_win.cc5
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_win.h8
-rw-r--r--chrome/common/render_messages_internal.h6
-rw-r--r--chrome/renderer/render_view.cc20
-rw-r--r--chrome/renderer/render_view.h7
24 files changed, 145 insertions, 29 deletions
diff --git a/chrome/browser/chromeos/app_launcher.cc b/chrome/browser/chromeos/app_launcher.cc
index 538fae3..ea95e7a 100644
--- a/chrome/browser/chromeos/app_launcher.cc
+++ b/chrome/browser/chromeos/app_launcher.cc
@@ -470,7 +470,9 @@ void AppLauncher::ShowCreatedWindow(int route_id,
}
void AppLauncher::StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops) {
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
// We're not going to do any drag & drop, but we have to tell the renderer the
// drag & drop ended, othewise the renderer thinks the drag operation is
// underway and mouse events won't work.
diff --git a/chrome/browser/chromeos/app_launcher.h b/chrome/browser/chromeos/app_launcher.h
index f9fbdbc..f6497d8 100644
--- a/chrome/browser/chromeos/app_launcher.h
+++ b/chrome/browser/chromeos/app_launcher.h
@@ -19,8 +19,10 @@
class Browser;
class RenderWidgetHostViewGtk;
class SiteInstance;
+class SkBitmap;
namespace gfx {
+class Point;
class Size;
}
namespace views {
@@ -168,7 +170,9 @@ class AppLauncher : public RenderViewHostDelegate,
const gfx::Rect& initial_pos) {}
virtual void ShowContextMenu(const ContextMenuParams& params) {}
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops);
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
virtual void GotFocus() {}
virtual void TakeFocus(bool reverse) {}
diff --git a/chrome/browser/cocoa/notifications/balloon_view_host_mac.h b/chrome/browser/cocoa/notifications/balloon_view_host_mac.h
index 442c2bb..a6268d2 100644
--- a/chrome/browser/cocoa/notifications/balloon_view_host_mac.h
+++ b/chrome/browser/cocoa/notifications/balloon_view_host_mac.h
@@ -16,6 +16,10 @@
class Profile;
class RenderViewHost;
+class SkBitmap;
+namespace gfx {
+class Point;
+}
// BalloonViewHost class is a delegate to the renderer host for the HTML
// notification. When initialized it creates a new RenderViewHost and loads
@@ -77,7 +81,9 @@ class BalloonViewHost : public RenderViewHostDelegate,
const gfx::Rect& initial_pos) {}
virtual void ShowContextMenu(const ContextMenuParams& params) {}
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops) {}
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {}
virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
virtual void GotFocus() {}
virtual void TakeFocus(bool reverse) {}
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 7998295..2470969 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -577,7 +577,9 @@ void ExtensionHost::ShowContextMenu(const ContextMenuParams& params) {
}
void ExtensionHost::StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask operation_mask) {
+ WebDragOperationsMask operation_mask,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
// We're not going to do any drag & drop, but we have to tell the renderer the
// drag & drop ended, othewise the renderer thinks the drag operation is
// underway and mouse events won't work. See bug 34061.
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index 6e50f72..ad26e9f 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -146,7 +146,9 @@ class ExtensionHost : public RenderViewHostDelegate,
const gfx::Rect& initial_pos);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_operations);
+ WebKit::WebDragOperationsMask allowed_operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
diff --git a/chrome/browser/gtk/notifications/balloon_view_host_gtk.h b/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
index 22e8cda..de71a41 100644
--- a/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
+++ b/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
@@ -80,7 +80,9 @@ class BalloonViewHost : public RenderViewHostDelegate,
const gfx::Rect& initial_pos) {}
virtual void ShowContextMenu(const ContextMenuParams& params) {}
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops) {}
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {}
virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
virtual void GotFocus() {}
virtual void TakeFocus(bool reverse) {}
diff --git a/chrome/browser/gtk/tab_contents_drag_source.cc b/chrome/browser/gtk/tab_contents_drag_source.cc
index 081feb5..6d9ca4c 100644
--- a/chrome/browser/gtk/tab_contents_drag_source.cc
+++ b/chrome/browser/gtk/tab_contents_drag_source.cc
@@ -70,7 +70,9 @@ TabContents* TabContentsDragSource::tab_contents() const {
}
void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
- GdkEventButton* last_mouse_down) {
+ GdkEventButton* last_mouse_down,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
int targets_mask = 0;
if (!drop_data.plain_text.empty())
@@ -99,6 +101,8 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
}
drop_data_.reset(new WebDropData(drop_data));
+ drag_image_ = image;
+ image_offset_ = image_offset;
GtkTargetList* list = gtk_dnd_util::GetTargetListFromCodeMask(targets_mask);
if (targets_mask & gtk_dnd_util::CHROME_WEBDROP_FILE_CONTENTS) {
@@ -304,6 +308,14 @@ void TabContentsDragSource::OnDragBegin(GdkDragContext* drag_context) {
generated_download_file_name.value().c_str()),
generated_download_file_name.value().length());
}
+
+ if (!drag_image_.isNull()) {
+ GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&drag_image_);
+ gtk_drag_set_icon_pixbuf(drag_context, pixbuf,
+ image_offset_.x(), image_offset_.y());
+ // Let the drag take ownership.
+ g_object_unref(pixbuf);
+ }
}
void TabContentsDragSource::OnDragEnd(GdkDragContext* drag_context,
diff --git a/chrome/browser/gtk/tab_contents_drag_source.h b/chrome/browser/gtk/tab_contents_drag_source.h
index aa0216e..7740ee6 100644
--- a/chrome/browser/gtk/tab_contents_drag_source.h
+++ b/chrome/browser/gtk/tab_contents_drag_source.h
@@ -9,10 +9,12 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/gfx/point.h"
#include "base/message_loop.h"
#include "base/string16.h"
#include "gfx/native_widget_types.h"
#include "googleurl/src/gurl.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
class TabContents;
@@ -31,7 +33,9 @@ class TabContentsDragSource : public MessageLoopForUI::Observer {
// Starts a drag for the tab contents this TabContentsDragSource was
// created for.
void StartDragging(const WebDropData& drop_data,
- GdkEventButton* last_mouse_down);
+ GdkEventButton* last_mouse_down,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
// MessageLoop::Observer implementation:
virtual void WillProcessEvent(GdkEvent* event);
@@ -79,6 +83,11 @@ class TabContentsDragSource : public MessageLoopForUI::Observer {
// view). Non-NULL iff there is a current drag.
scoped_ptr<WebDropData> drop_data_;
+ // The image used for depicting the drag, and the offset between the cursor
+ // and the top left pixel.
+ SkBitmap drag_image_;
+ gfx::Point image_offset_;
+
// The mime type for the file contents of the current drag (if any).
GdkAtom drag_file_mime_type_;
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 615a247..1c76a24 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1389,10 +1389,12 @@ void RenderViewHost::OnMsgFormFieldValuesSubmitted(
void RenderViewHost::OnMsgStartDragging(
const WebDropData& drop_data,
- WebDragOperationsMask drag_operations_mask) {
+ WebDragOperationsMask drag_operations_mask,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
if (view)
- view->StartDragging(drop_data, drag_operations_mask);
+ view->StartDragging(drop_data, drag_operations_mask, image, image_offset);
}
void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 27fb3ff..cc52d47 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -549,7 +549,9 @@ class RenderViewHost : public RenderWidgetHost {
const std::vector<webkit_glue::PasswordForm>& forms);
void OnMsgFormFieldValuesSubmitted(const webkit_glue::FormFieldValues& forms);
void OnMsgStartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask operations_allowed);
+ WebKit::WebDragOperationsMask operations_allowed,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation);
void OnTakeFocus(bool reverse);
void OnMsgPageHasOSDD(int32 page_id, const GURL& doc_url, bool autodetected);
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 535bb1f..ff10230 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -44,6 +44,7 @@ class WaitableEvent;
}
namespace gfx {
+class Point;
class Rect;
class Size;
}
@@ -118,7 +119,9 @@ class RenderViewHostDelegate {
// RenderView. Contextual information about the dragged content is supplied
// by WebDropData.
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops) = 0;
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) = 0;
// The page wants to update the mouse cursor during a drag & drop operation.
// |operation| describes the current operation (none, move, copy, link.)
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 555e655..2be9448 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -96,7 +96,9 @@ class InterstitialPage::InterstitialPageRVHViewDelegate
const gfx::Rect& initial_pos);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask operations_allowed);
+ WebDragOperationsMask operations_allowed,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
@@ -578,7 +580,9 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::ShowContextMenu(
void InterstitialPage::InterstitialPageRVHViewDelegate::StartDragging(
const WebDropData& drop_data,
- WebDragOperationsMask allowed_operations) {
+ WebDragOperationsMask allowed_operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
NOTREACHED() << "InterstitialPage does not support dragging yet.";
}
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index f7286de..b636757 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -323,10 +323,13 @@ void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
// Render view DnD -------------------------------------------------------------
void TabContentsViewGtk::StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask ops) {
+ WebDragOperationsMask ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
DCHECK(GetContentNativeView());
- drag_source_->StartDragging(drop_data, &last_mouse_down_);
+ drag_source_->StartDragging(drop_data, &last_mouse_down_, image,
+ image_offset);
// TODO(snej): Make use of the WebDragOperationsMask somehow
}
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h
index 954e560..1bded49b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h
@@ -57,7 +57,9 @@ class TabContentsViewGtk : public TabContentsView,
// Backend implementation of RenderViewHostDelegate::View.
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops);
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h
index 3a3d4c8..e195cbc 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.h
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.h
@@ -20,9 +20,13 @@ class FilePath;
class FindBarMac;
@class FocusTracker;
@class SadTabController;
+class SkBitmap;
class TabContentsViewMac;
@class WebDragSource;
@class WebDropTarget;
+namespace gfx {
+class Point;
+}
@interface TabContentsViewCocoa : BaseView {
@private
@@ -73,7 +77,9 @@ class TabContentsViewMac : public TabContentsView,
// Backend implementation of RenderViewHostDelegate::View.
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_operations);
+ WebKit::WebDragOperationsMask allowed_operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 6949621..a2b622e 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -126,8 +126,11 @@ void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const {
*out = [cocoa_view_.get() NSRectToRect:[cocoa_view_.get() bounds]];
}
-void TabContentsViewMac::StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask allowed_operations) {
+void TabContentsViewMac::StartDragging(
+ const WebDropData& drop_data,
+ WebDragOperationsMask allowed_operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
// By allowing nested tasks, the code below also allows Close(),
// which would deallocate |this|. The same problem can occur while
// processing -sendEvent:, so Close() is deferred in that case.
@@ -138,6 +141,7 @@ void TabContentsViewMac::StartDragging(const WebDropData& drop_data,
// The drag invokes a nested event loop, arrange to continue
// processing events.
MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
+ // TODO(estade): make use of |image| and |image_offset|.
NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations);
[cocoa_view_ startDragWithDropData:drop_data
dragOperationMask:mask];
diff --git a/chrome/browser/views/notifications/balloon_view_host.h b/chrome/browser/views/notifications/balloon_view_host.h
index f64d8b8..84610a0 100644
--- a/chrome/browser/views/notifications/balloon_view_host.h
+++ b/chrome/browser/views/notifications/balloon_view_host.h
@@ -16,6 +16,10 @@
class Profile;
class RenderViewHost;
+class SkBitmap;
+namespace gfx {
+class Point;
+}
// BalloonViewHost class is a delegate to the renderer host for the HTML
// notification. When initialized it creates a new RenderViewHost and loads
@@ -71,7 +75,9 @@ class BalloonViewHost : public views::NativeViewHost,
const gfx::Rect& initial_pos) {}
virtual void ShowContextMenu(const ContextMenuParams& params) {}
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops) {}
+ WebKit::WebDragOperationsMask allowed_ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {}
virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
virtual void GotFocus() {}
virtual void TakeFocus(bool reverse) {}
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
index 91b25ce..4a9870e 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
@@ -219,8 +219,11 @@ void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const {
}
void TabContentsViewGtk::StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask ops) {
- drag_source_->StartDragging(drop_data, &last_mouse_down_);
+ WebDragOperationsMask ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
+ drag_source_->StartDragging(drop_data, &last_mouse_down_,
+ image, image_offset);
// TODO(snej): Make use of WebDragOperationsMask
}
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
index 3439ec5..e88c3f9 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
@@ -16,8 +16,12 @@ class ConstrainedWindowGtk;
typedef struct _GtkFloatingContainer GtkFloatingContainer;
class RenderViewContextMenuGtk;
class SadTabView;
+class SkBitmap;
class TabContentsDragSource;
class WebDragDestGtk;
+namespace gfx {
+class Point;
+}
namespace views {
class NativeViewHost;
}
@@ -61,7 +65,9 @@ class TabContentsViewGtk : public TabContentsView,
// Backend implementation of RenderViewHostDelegate::View.
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops_allowed);
+ WebKit::WebDragOperationsMask ops_allowed,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc
index 5af44c6..243017e 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc
@@ -125,8 +125,11 @@ void TabContentsViewWin::GetContainerBounds(gfx::Rect* out) const {
}
void TabContentsViewWin::StartDragging(const WebDropData& drop_data,
- WebDragOperationsMask ops) {
+ WebDragOperationsMask ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
drag_handler_ = new TabContentsDragWin(this);
+ // TODO(estade): make use of |image| and |image_offset|.
drag_handler_->StartDragging(drop_data, ops);
}
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.h b/chrome/browser/views/tab_contents/tab_contents_view_win.h
index 61177bc..27f50fe 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_win.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_win.h
@@ -13,10 +13,14 @@
class RenderViewContextMenuWin;
class SadTabView;
+class SkBitmap;
class TabContentsDragWin;
struct WebDropData;
class WebDragSource;
class WebDropTarget;
+namespace gfx {
+class Point;
+}
// Windows-specific implementation of the TabContentsView. It is a HWND that
// contains all of the contents of the tab and associated child views.
@@ -55,7 +59,9 @@ class TabContentsViewWin : public TabContentsView,
// Backend implementation of RenderViewHostDelegate::View.
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask operations);
+ WebKit::WebDragOperationsMask operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
virtual void GotFocus();
virtual void TakeFocus(bool reverse);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 8fd3b9d..d07665a 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1447,9 +1447,11 @@ IPC_BEGIN_MESSAGES(ViewHost)
// WebDropData struct contains contextual information about the pieces of the
// page the user dragged. The parent uses this notification to initiate a
// drag session at the OS level.
- IPC_MESSAGE_ROUTED2(ViewHostMsg_StartDragging,
+ IPC_MESSAGE_ROUTED4(ViewHostMsg_StartDragging,
WebDropData /* drop_data */,
- WebKit::WebDragOperationsMask /* ops_allowed */)
+ WebKit::WebDragOperationsMask /* ops_allowed */,
+ SkBitmap /* image */,
+ gfx::Point /* image_offset */)
// The page wants to update the mouse cursor during a drag & drop operation.
// |is_drop_target| is true if the mouse is over a valid drop target.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index deb5c99..818cbd0 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -82,6 +82,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebImage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h"
@@ -155,6 +156,7 @@ using WebKit::WebFindOptions;
using WebKit::WebFormElement;
using WebKit::WebFrame;
using WebKit::WebHistoryItem;
+using WebKit::WebImage;
using WebKit::WebInputElement;
using WebKit::WebMediaPlayer;
using WebKit::WebMediaPlayerAction;
@@ -1908,9 +1910,25 @@ void RenderView::setToolTipText(const WebString& text, WebTextDirection hint) {
void RenderView::startDragging(const WebPoint& from, const WebDragData& data,
WebDragOperationsMask allowed_ops) {
+ startDragging(data, allowed_ops, WebImage(), WebPoint());
+}
+
+void RenderView::startDragging(const WebDragData& data,
+ WebDragOperationsMask mask,
+ const WebImage& image,
+ const WebPoint& imageOffset) {
+#if WEBKIT_USING_SKIA
+ SkBitmap bitmap(image.getSkBitmap());
+#elif WEBKIT_USING_CG
+ // Needs implementing: http://crbug.com/11457
+ SkBitmap bitmap;
+#endif
+
Send(new ViewHostMsg_StartDragging(routing_id_,
WebDropData(data),
- allowed_ops));
+ mask,
+ bitmap,
+ imageOffset));
}
bool RenderView::acceptsLoadDrops() {
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 618425c..8f7ec80 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -102,12 +102,14 @@ namespace WebKit {
class WebAccessibilityCache;
class WebDataSource;
class WebDragData;
+class WebImage;
class WebMediaPlayer;
class WebMediaPlayerClient;
class WebStorageNamespace;
class WebURLRequest;
struct WebFileChooserParams;
struct WebFindOptions;
+struct WebPoint;
}
// We need to prevent a page from trying to create infinite popups. It is not
@@ -250,6 +252,11 @@ class RenderView : public RenderWidget,
virtual void startDragging(
const WebKit::WebPoint& from, const WebKit::WebDragData& data,
WebKit::WebDragOperationsMask mask);
+ virtual void startDragging(
+ const WebKit::WebDragData& data,
+ WebKit::WebDragOperationsMask mask,
+ const WebKit::WebImage& image,
+ const WebKit::WebPoint& imageOffset);
virtual bool acceptsLoadDrops();
virtual void focusNext();
virtual void focusPrevious();