commit | e5f6b51f8a15613ff7031f8c4227495642438bd5 | [log] [tgz] |
---|---|---|
author | Henrique Ferreiro <[email protected]> | Thu Oct 08 11:38:20 2020 |
committer | Commit Bot <[email protected]> | Thu Oct 08 11:38:20 2020 |
tree | 034f2c9927ab10ee6df8c549979bb25f79abf920 | |
parent | d79672b41635a9d5f79d7d78e17c7e95c3c3b978 [diff] |
Fix dragging of images out of the browser When porting StartDragging to Mojo in https://crrev.com/c/2320268, the image contents weren't being set in the drop data. This resulted in a link being saved on Windows and an error shown on Linux. (cherry picked from commit 35b04f213302a76240a199e0b18ff48d8259a10c) Bug: 1039255, 1132953 Change-Id: I2d21e0424c89306d5df8caf940e93999d16f78f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444996 Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Henrique Ferreiro <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#813645} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461228 Reviewed-by: Henrique Ferreiro <[email protected]> Cr-Commit-Position: refs/branch-heads/4280@{#139} Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/content/browser/renderer_host/drop_data_util.cc b/content/browser/renderer_host/drop_data_util.cc index e56df58..021f0fc 100644 --- a/content/browser/renderer_host/drop_data_util.cc +++ b/content/browser/renderer_host/drop_data_util.cc
@@ -117,7 +117,8 @@ DCHECK(result.file_contents.empty()); const blink::mojom::DragItemBinaryPtr& binary_item = item->get_binary(); - result.file_contents.reserve(binary_item->data.size()); + std::vector<uint8_t> contents = binary_item->data; + result.file_contents.assign(contents.begin(), contents.end()); result.file_contents_source_url = binary_item->source_url; result.file_contents_filename_extension = binary_item->filename_extension.value();