| Index: content/renderer/render_view_impl.cc
|
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
| index fe5f163c4bd58992eec62c648ff44ad5116d9158..bec4737e9b8adacf342f0a390c0b01a2665288c3 100644
|
| --- a/content/renderer/render_view_impl.cc
|
| +++ b/content/renderer/render_view_impl.cc
|
| @@ -392,6 +392,54 @@ static void ConvertToFaviconSizes(
|
|
|
| namespace {
|
|
|
| +WebDragData DropMetaDataToWebDragData(
|
| + const std::vector<DropData::Metadata>& drop_meta_data) {
|
| + std::vector<WebDragData::Item> item_list;
|
| + for (const auto& meta_data_item : drop_meta_data) {
|
| + if (meta_data_item.kind == DropData::Kind::STRING) {
|
| + WebDragData::Item item;
|
| + item.storageType = WebDragData::Item::StorageTypeString;
|
| + item.stringType = meta_data_item.mime_type;
|
| + // Have to pass a dummy URL here instead of an empty URL because the
|
| + // DropData received by browser_plugins goes through a round trip:
|
| + // DropData::MetaData --> WebDragData-->DropData. In the end, DropData
|
| + // will contain an empty URL (which means no URL is dragged) if the URL in
|
| + // WebDragData is empty.
|
| + if (base::EqualsASCII(meta_data_item.mime_type,
|
| + ui::Clipboard::kMimeTypeURIList)) {
|
| + item.stringData = WebString::fromUTF8("about:dragdrop-placeholder");
|
| + }
|
| + item_list.push_back(item);
|
| + continue;
|
| + }
|
| +
|
| + // TODO(hush): crbug.com/584789. Blink needs to support creating a file with
|
| + // just the mimetype. This is needed to drag files to WebView on Android
|
| + // platform.
|
| + if ((meta_data_item.kind == DropData::Kind::FILENAME) &&
|
| + !meta_data_item.filename.empty()) {
|
| + WebDragData::Item item;
|
| + item.storageType = WebDragData::Item::StorageTypeFilename;
|
| + item.filenameData = meta_data_item.filename.AsUTF16Unsafe();
|
| + item_list.push_back(item);
|
| + continue;
|
| + }
|
| +
|
| + if (meta_data_item.kind == DropData::Kind::FILESYSTEMFILE) {
|
| + WebDragData::Item item;
|
| + item.storageType = WebDragData::Item::StorageTypeFileSystemFile;
|
| + item.fileSystemURL = meta_data_item.file_system_url;
|
| + 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;
|
|
|
| @@ -408,8 +456,6 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| item_list.push_back(item);
|
| }
|
|
|
| - // TODO(dcheng): Do we need to distinguish between null and empty URLs? Is it
|
| - // meaningful to write an empty URL to the clipboard?
|
| if (!drop_data.url.is_empty()) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeString;
|
| @@ -2331,17 +2377,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<DropData::Metadata>& 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));
|
| }
|
| @@ -2363,11 +2407,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,
|
|
|