Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index bb6f263617d079a0700b50749263c169b07715f4..734a3b803e2916c166a0dd57b7aba7d0a8f04bc3 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -426,6 +426,39 @@ class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget { |
blink::WebWidget* webwidget_; |
}; |
+WebDragData DropMetaDataToWebDragData( |
+ const std::vector<MimeTypeKindPair> drop_meta_data) { |
+ std::vector<WebDragData::Item> item_list; |
+ for (MimeTypeKindPair pair : drop_meta_data) { |
+ if (pair.second == base::ASCIIToUTF16("string")) { |
+ WebDragData::Item item; |
+ item.storageType = WebDragData::Item::StorageTypeString; |
+ item.stringType = pair.first; |
+ item_list.push_back(item); |
+ continue; |
+ } |
+ |
+ if (pair.second == base::ASCIIToUTF16("filename")) { |
+ WebDragData::Item item; |
+ item.storageType = WebDragData::Item::StorageTypeFilename; |
+ item_list.push_back(item); |
+ continue; |
+ } |
+ |
+ if (pair.second == base::ASCIIToUTF16("filesystemfile")) { |
Avi (use Gerrit)
2016/04/08 21:24:08
I very much dislike the idea of matching up string
hush (inactive)
2016/04/12 00:07:49
I will use an enum type, defined in drop_data.h, w
|
+ 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; |
@@ -2336,17 +2369,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, |
+ 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)); |
} |
@@ -2368,11 +2399,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, |