diff options
author | hnoda@google.com <hnoda@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 17:11:57 +0000 |
---|---|---|
committer | hnoda@google.com <hnoda@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 17:11:57 +0000 |
commit | fcad494579ca15abbb60a4c45ce068206b049299 (patch) | |
tree | bf76f9177a266d81acf9badbc582a9dd3fa975af /content | |
parent | a08f27b9cdae490a53a49792cdec154fa3c4afcd (diff) | |
download | chromium_src-fcad494579ca15abbb60a4c45ce068206b049299.zip chromium_src-fcad494579ca15abbb60a4c45ce068206b049299.tar.gz chromium_src-fcad494579ca15abbb60a4c45ce068206b049299.tar.bz2 |
File upload API in chromedriver
Added support for file upload API in /session/:sessionId/element/:id/value. If the given element is a file upload control, the file paths are set to the file upload control using drag and drop emulation.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7055004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 8 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.h | 1 | ||||
-rw-r--r-- | content/common/drag_messages.h | 3 | ||||
-rw-r--r-- | content/common/notification_type.h | 5 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 2 |
5 files changed, 19 insertions, 0 deletions
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 5030cc6..2701853 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -684,6 +684,7 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnMsgRunBeforeUnloadConfirm) IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnMsgStartDragging) IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) + IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) @@ -1048,6 +1049,13 @@ void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { view->UpdateDragCursor(current_op); } +void RenderViewHost::OnTargetDropACK() { + NotificationService::current()->Notify( + NotificationType::RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, + Source<RenderViewHost>(this), + NotificationService::NoDetails()); +} + void RenderViewHost::OnTakeFocus(bool reverse) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 3420536..c4dae8a 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -438,6 +438,7 @@ class RenderViewHost : public RenderWidgetHost { const SkBitmap& image, const gfx::Point& image_offset); void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); + void OnTargetDropACK(); void OnTakeFocus(bool reverse); void OnAddMessageToConsole(int32 level, const std::wstring& message, diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h index 6e0507b..a8ac21f 100644 --- a/content/common/drag_messages.h +++ b/content/common/drag_messages.h @@ -75,3 +75,6 @@ IPC_MESSAGE_ROUTED4(DragHostMsg_StartDragging, // |is_drop_target| is true if the mouse is over a valid drop target. IPC_MESSAGE_ROUTED1(DragHostMsg_UpdateDragCursor, WebKit::WebDragOperation /* drag_operation */) + +// Notifies the host that the renderer finished a drop operation. +IPC_MESSAGE_ROUTED0(DragHostMsg_TargetDrop_ACK) diff --git a/content/common/notification_type.h b/content/common/notification_type.h index 93a5513..418df4e 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -482,6 +482,11 @@ class NotificationType { // initiated by window.close(). RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, + // This notifies the observer that the drag operation ack in a drag and + // drop operation was received. The source is the RenderViewHost. + // Note: Used only in testing. + RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, + // Indicates a RenderWidgetHost has been hidden or restored. The source is // the RWH whose visibility changed, the details is a bool set to true if // the new state is "visible." diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index b183d3f..677c1ca 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -3357,6 +3357,8 @@ void RenderView::OnDragTargetDragLeave() { void RenderView::OnDragTargetDrop(const gfx::Point& client_point, const gfx::Point& screen_point) { webview()->dragTargetDrop(client_point, screen_point); + + Send(new DragHostMsg_TargetDrop_ACK(routing_id_)); } void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point, |