|
|
Only generate suggested filenames when actually dragging an image.
ResourceResponse::suggestedFilename() is only used when dragging an
image out of a WebView, yet it was still calculated for every resource
response.
As previously implemented, there were a number of other issues:
- The suggested filename calculation was implemented in //content/child.
However, in Blink, DataTransfer didn't know that the calculation, as
implemented, would never be empty. Thus, it implemented fallback paths
for an empty filename, even though it was never possible to reach it.
- In //content/browser, the code to start the actual drag also tried to
handle the empty filename case, even though the fallback path should
never be hit.
- Blink also had filename validation code that was used only by the
image dragging code.
This CL plumbs the information needed to calculate the filename:
- the image URL
- the filename extension, as reported by the image decoder
- the Content-Disposition header, if any
up into the browser process and performs the calculation there. This
allows all the logic regarding filename validation to be centralized in
one location.
Note that this CL does not plumb the filename extension through as a
MIME type. This is intentional: though this would make the code more
generic so future CLs could add support for dragging non-image binary
data, consulting the MIME registry to determine the right filename
extension often involves filesystem I/O, which should be avoided on the
UI thread.
BUG= 654034
Review-Url: https://codereview.chromium.org/2674953003
Cr-Commit-Position: refs/heads/master@{#448946}
Committed: https://chromium.googlesource.com/chromium/src/+/3dd8561d357d05ba538137ed8736b8732e27c0d8
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+182 lines, -406 lines) |
Patch |
 |
M |
components/test_runner/event_sender.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
4 chunks |
+21 lines, -5 lines |
0 comments
|
Download
|
 |
M |
content/browser/web_contents/web_contents_view_aura.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+4 lines, -11 lines |
0 comments
|
Download
|
 |
M |
content/browser/web_contents/web_drag_source_mac.mm
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+6 lines, -34 lines |
0 comments
|
Download
|
 |
M |
content/child/web_url_loader_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+1 line, -13 lines |
0 comments
|
Download
|
 |
M |
content/common/drag_traits.h
|
View
|
1
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/public/common/BUILD.gn
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
content/public/common/DEPS
|
View
|
1
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
content/public/common/drop_data.h
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+11 lines, -3 lines |
0 comments
|
Download
|
 |
M |
content/public/common/drop_data.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+31 lines, -10 lines |
0 comments
|
Download
|
 |
M |
content/renderer/drop_data_builder.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+10 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/render_widget.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataObject.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+4 lines, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataObject.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+11 lines, -6 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataObjectItem.h
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+7 lines, -2 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+12 lines, -4 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataTransfer.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+4 lines, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+9 lines, -40 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/loader/DocumentLoader.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/loader/ProgressTrackerTest.cpp
|
View
|
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResourceTest.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
15 chunks |
+21 lines, -30 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/core/page/DragController.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/BUILD.gn
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
4 chunks |
+2 lines, -9 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/clipboard/ClipboardUtilities.h
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
 |
D |
third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesPosix.cpp
|
View
|
1
|
1 chunk |
+0 lines, -58 lines |
0 comments
|
Download
|
 |
D |
third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesTest.cpp
|
View
|
1
|
1 chunk |
+0 lines, -92 lines |
0 comments
|
Download
|
 |
D |
third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesWin.cpp
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+0 lines, -21 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/exported/WebURLResponse.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+0 lines, -8 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/network/ResourceResponse.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
4 chunks |
+1 line, -11 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/network/ResourceResponse.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
7 chunks |
+4 lines, -22 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/public/platform/WebDragData.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+11 lines, -7 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/public/platform/WebURLResponse.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+0 lines, -3 lines |
0 comments
|
Download
|
Total messages: 70 (54 generated)
|