Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Issue 2674953003: Only generate suggested filenames when actually dragging an image. (Closed)

Created:
3 years, 10 months ago by dcheng
Modified:
3 years, 10 months ago
CC:
blink-reviews, blink-reviews-api_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, gavinp+loader_chromium.org, jam, Nate Chapin, kinuko+watch, loading-reviews_chromium.org, loading-reviews+fetch_chromium.org, pwnall, tyoshino+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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

Patch Set 1 #

Patch Set 2 : FilePath is horrible #

Patch Set 3 : Fix GN deps #

Patch Set 4 : . #

Patch Set 5 : Fix Mac #

Patch Set 6 : . #

Patch Set 7 : Probably compiles now. #

Patch Set 8 : Meh #

Patch Set 9 : Preserve behavior #

Patch Set 10 : Fix build again #

Patch Set 11 : Maybe? #

Total comments: 4

Patch Set 12 : rebase #

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

Messages

Total messages: 70 (54 generated)
dcheng
kinuko, please take a look when you have time. +csharrison FYI
3 years, 10 months ago (2017-02-05 04:48:27 UTC) #38
kinuko
lgtm Great to see us removing these wasteful code paths! https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc File components/test_runner/event_sender.cc (right): https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc#newcode1912 ...
3 years, 10 months ago (2017-02-06 22:24:58 UTC) #47
Charlie Harrison
Awesome work, many thanks for taking this on :) lgtm/2
3 years, 10 months ago (2017-02-06 22:51:10 UTC) #48
dcheng
https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc File components/test_runner/event_sender.cc (right): https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc#newcode1912 components/test_runner/event_sender.cc:1912: filename = filename.ReplaceExtension(filename_extension.utf8()); On 2017/02/06 22:24:58, kinuko wrote: > ...
3 years, 10 months ago (2017-02-08 00:01:05 UTC) #49
dcheng
+tkent for //components/test_runner +asanka for new DEPS on //components/mime_util from //content/public
3 years, 10 months ago (2017-02-08 01:00:27 UTC) #51
kinuko
On 2017/02/08 00:01:05, dcheng wrote: > https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc > File components/test_runner/event_sender.cc (right): > > https://codereview.chromium.org/2674953003/diff/200001/components/test_runner/event_sender.cc#newcode1912 > ...
3 years, 10 months ago (2017-02-08 01:14:41 UTC) #52
tkent
On 2017/02/08 at 01:00:27, dcheng wrote: > +tkent for //components/test_runner lgtm
3 years, 10 months ago (2017-02-08 01:23:06 UTC) #53
asanka
https://codereview.chromium.org/2674953003/diff/200001/content/public/common/DEPS File content/public/common/DEPS (right): https://codereview.chromium.org/2674953003/diff/200001/content/public/common/DEPS#newcode4 content/public/common/DEPS:4: "+components/mime_util", Has there been a change to the rule ...
3 years, 10 months ago (2017-02-08 04:20:21 UTC) #54
dcheng
On 2017/02/08 04:20:21, asanka wrote: > https://codereview.chromium.org/2674953003/diff/200001/content/public/common/DEPS > File content/public/common/DEPS (right): > > https://codereview.chromium.org/2674953003/diff/200001/content/public/common/DEPS#newcode4 > ...
3 years, 10 months ago (2017-02-08 04:29:18 UTC) #55
asanka
lgtm
3 years, 10 months ago (2017-02-08 04:47:33 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2674953003/200001
3 years, 10 months ago (2017-02-08 04:50:54 UTC) #58
commit-bot: I haz the power
Failed to apply patch for third_party/WebKit/Source/platform/BUILD.gn: While running git apply --index -p1; error: patch failed: ...
3 years, 10 months ago (2017-02-08 06:35:18 UTC) #60
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2674953003/210001
3 years, 10 months ago (2017-02-08 07:39:01 UTC) #63
commit-bot: I haz the power
Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_swarming_rel/builds/114709)
3 years, 10 months ago (2017-02-08 09:18:36 UTC) #65
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2674953003/210001
3 years, 10 months ago (2017-02-08 09:23:34 UTC) #67
commit-bot: I haz the power
3 years, 10 months ago (2017-02-08 10:47:13 UTC) #70
Message was sent while issue was closed.
Committed patchset #12 (id:210001) as
https://chromium.googlesource.com/chromium/src/+/3dd8561d357d05ba538137ed8736...

Powered by Google App Engine
This is Rietveld 408576698