diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
commit | 1d9f4137eff50f1305e288767bb770151526552d (patch) | |
tree | 4ae1750d34778e7b0ae23dfe315118cf124c3715 /chrome/browser/renderer_host/render_view_host.cc | |
parent | c7f475ed4a9fd8f198468df696c55e1c75d65526 (diff) | |
download | chromium_src-1d9f4137eff50f1305e288767bb770151526552d.zip chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.gz chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.bz2 |
Plumb the DragOperation through all the layers between the platform Drag-n-drop code and WebCore.
This allows the HTML5 DataTransfer effectAllowed and dropEffect properties to be set correctly in JS handlers, as per the HTML5 spec.
(The drag-dropeffect test isn't in WebKit yet -- it's part of a separate WebKit patch that's been in review for weeks.)
R=darin,pink
BUG=http://code.google.com/p/chromium/issues/detail?id=14654, http://code.google.com/p/chromium/issues/detail?id=20985
TEST=LayoutTests/fast/events/drag-dropeffect.html, LayoutTests/editing/pasteboard/files-during-page-drags.html
Review URL: http://codereview.chromium.org/174364
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_view_host.cc')
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index ba82b80..066d1cc 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -49,6 +49,9 @@ using base::TimeDelta; using webkit_glue::PasswordFormDomManager; using WebKit::WebConsoleMessage; +using WebKit::WebDragOperation; +using WebKit::WebDragOperationNone; +using WebKit::WebDragOperationsMask; using WebKit::WebFindOptions; using WebKit::WebInputEvent; using WebKit::WebTextDirection; @@ -460,7 +463,8 @@ void RenderViewHost::FillPasswordForm( void RenderViewHost::DragTargetDragEnter( const WebDropData& drop_data, const gfx::Point& client_pt, - const gfx::Point& screen_pt) { + const gfx::Point& screen_pt, + WebDragOperationsMask operations_allowed) { // Grant the renderer the ability to load the drop_data. ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); @@ -473,12 +477,14 @@ void RenderViewHost::DragTargetDragEnter( policy->GrantUploadFile(process()->id(), path); } Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, - screen_pt)); + screen_pt, operations_allowed)); } void RenderViewHost::DragTargetDragOver( - const gfx::Point& client_pt, const gfx::Point& screen_pt) { - Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt)); + const gfx::Point& client_pt, const gfx::Point& screen_pt, + WebDragOperationsMask operations_allowed) { + Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt, + operations_allowed)); } void RenderViewHost::DragTargetDragLeave() { @@ -608,22 +614,14 @@ void RenderViewHost::CopyImageAt(int x, int y) { Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); } -void RenderViewHost::DragSourceCancelledAt( - int client_x, int client_y, int screen_x, int screen_y) { - Send(new ViewMsg_DragSourceEndedOrMoved( - routing_id(), - gfx::Point(client_x, client_y), - gfx::Point(screen_x, screen_y), - true, true)); -} - void RenderViewHost::DragSourceEndedAt( - int client_x, int client_y, int screen_x, int screen_y) { + int client_x, int client_y, int screen_x, int screen_y, + WebDragOperation operation) { Send(new ViewMsg_DragSourceEndedOrMoved( routing_id(), gfx::Point(client_x, client_y), gfx::Point(screen_x, screen_y), - true, false)); + true, operation)); } void RenderViewHost::DragSourceMovedTo( @@ -632,7 +630,7 @@ void RenderViewHost::DragSourceMovedTo( routing_id(), gfx::Point(client_x, client_y), gfx::Point(screen_x, screen_y), - false, false)); + false, WebDragOperationNone)); } void RenderViewHost::DragSourceSystemDragEnded() { @@ -1331,16 +1329,17 @@ void RenderViewHost::OnMsgAutofillFormSubmitted( } void RenderViewHost::OnMsgStartDragging( - const WebDropData& drop_data) { + const WebDropData& drop_data, + WebDragOperationsMask drag_operations_mask) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) - view->StartDragging(drop_data); + view->StartDragging(drop_data, drag_operations_mask); } -void RenderViewHost::OnUpdateDragCursor(bool is_drop_target) { +void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) - view->UpdateDragCursor(is_drop_target); + view->UpdateDragCursor(current_op); } void RenderViewHost::OnTakeFocus(bool reverse) { |