Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index cc7ce3c5f9743b3b9b1d08e36807065a25889b7f..15fecf0a19a4f3279c7b5fa066b536492388bd5d 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -427,6 +427,39 @@ class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget { |
| blink::WebWidget* webwidget_; |
| }; |
| +WebDragData DropMetaDataToWebDragData( |
| + const std::vector<MimeTypeKindPair> drop_meta_data) { |
|
Avi (use Gerrit)
2016/04/12 02:51:51
const vector?
Did you mean const vector&?
hush (inactive)
2016/04/12 20:36:57
Yes, done
|
| + std::vector<WebDragData::Item> item_list; |
| + for (MimeTypeKindPair pair : drop_meta_data) { |
| + if (pair.second == STRING_KIND) { |
| + WebDragData::Item item; |
| + item.storageType = WebDragData::Item::StorageTypeString; |
| + item.stringType = pair.first; |
| + item_list.push_back(item); |
| + continue; |
| + } |
| + |
| + if (pair.second == FILENAME_KIND) { |
| + WebDragData::Item item; |
| + item.storageType = WebDragData::Item::StorageTypeFilename; |
| + item_list.push_back(item); |
| + continue; |
| + } |
| + |
| + if (pair.second == FILESYSTEMFILE_KIND) { |
| + WebDragData::Item item; |
| + item.storageType = WebDragData::Item::StorageTypeFileSystemFile; |
| + item_list.push_back(item); |
| + continue; |
| + } |
| + } |
| + |
| + WebDragData result; |
| + result.initialize(); |
| + result.setItems(item_list); |
| + return result; |
| +} |
| + |
| WebDragData DropDataToWebDragData(const DropData& drop_data) { |
| std::vector<WebDragData::Item> item_list; |
| @@ -2317,17 +2350,15 @@ void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { |
| main_render_frame_->MaybeEnableMojoBindings(); |
| } |
| -void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, |
| - const gfx::Point& client_point, |
| - const gfx::Point& screen_point, |
| - WebDragOperationsMask ops, |
| - int key_modifiers) { |
| +void RenderViewImpl::OnDragTargetDragEnter( |
| + const std::vector<MimeTypeKindPair> drop_meta_data, |
|
Avi (use Gerrit)
2016/04/12 02:51:51
const vector&?
hush (inactive)
2016/04/12 20:36:57
Done.
|
| + const gfx::Point& client_point, |
| + const gfx::Point& screen_point, |
| + WebDragOperationsMask ops, |
| + int key_modifiers) { |
| WebDragOperation operation = webview()->dragTargetDragEnter( |
| - DropDataToWebDragData(drop_data), |
| - ConvertWindowPointToViewport(client_point), |
| - screen_point, |
| - ops, |
| - key_modifiers); |
| + DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point, |
| + ops, key_modifiers); |
| Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
| } |
| @@ -2349,11 +2380,12 @@ void RenderViewImpl::OnDragTargetDragLeave() { |
| webview()->dragTargetDragLeave(); |
| } |
| -void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, |
| +void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data, |
| + const gfx::Point& client_point, |
| const gfx::Point& screen_point, |
| int key_modifiers) { |
| - webview()->dragTargetDrop( |
| - ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); |
| + webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point, |
| + screen_point, key_modifiers); |
| } |
| void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |