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

Issue 12850002: Move download filename determintion into a separate class. (Closed)

Created:
7 years, 9 months ago by asanka
Modified:
7 years, 7 months ago
CC:
chromium-reviews, benjhayden+dwatch_chromium.org, rdsmith+dwatch_chromium.org
Visibility:
Public.

Description

Move download filename determination into a separate class. * Extracts download filename determination into DownloadTargetDeterminer. The new class maintains state and observes the download. Doing so eliminates the need to pass state around as bound arguments. * Guarantees that the completion callback to DownloadManagerDelegate::DetermineDownloadTarget is always invoked, even if the download is interrupted on initialization. This is required for reliably resuming downloads. * The DownloadFilePicker always returns the virtual path for downloads to Drive. ChromeDownloadManagerDelegate can use it to keep track of the correct last selected directory for 'Save As' downloads. * Since no path subsubstituion is necessary during prompting, DownloadFilePickerChromeOS is no longer necessary. * Re-orders the sequence of events so that the user is prompted as early as possible. Expensive history database lookups won't introduce unnecssary jank. * History database lookups are only performed if the results of the lookup are necessary. * Downloads to Drive don't need the temporary local path to be determined twice when the default downloads directory is Drive. BUG=151618 BUG=104335 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=197518

Patch Set 1 : #

Total comments: 39

Patch Set 2 : Add comments #

Total comments: 30

Patch Set 3 : Address comments #

Total comments: 2

Patch Set 4 : Merge with r195576 #

Patch Set 5 : Finer grained delegate methods. #

Patch Set 6 : Get rid of download_file_picker_chromeos #

Total comments: 35

Patch Set 7 : Address comments. #

Total comments: 8

Patch Set 8 : Address comments. #

Patch Set 9 : Merge with r197053 #

Patch Set 10 : Fix tests #

Patch Set 11 : Fix tests on Android #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2834 lines, -1486 lines) Patch
M chrome/browser/download/chrome_download_manager_delegate.h View 1 2 3 4 5 6 7 4 chunks +34 lines, -110 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.cc View 1 2 3 4 5 6 7 8 9 chunks +132 lines, -477 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate_unittest.cc View 1 2 3 4 5 10 chunks +148 lines, -700 lines 0 comments Download
M chrome/browser/download/download_crx_util.cc View 1 2 1 chunk +6 lines, -2 lines 0 comments Download
M chrome/browser/download/download_file_picker.h View 1 2 3 4 5 6 7 2 chunks +31 lines, -28 lines 0 comments Download
M chrome/browser/download/download_file_picker.cc View 1 2 3 4 5 6 7 3 chunks +36 lines, -44 lines 0 comments Download
M chrome/browser/download/download_file_picker_chromeos.h View 1 2 3 4 5 1 chunk +0 lines, -37 lines 0 comments Download
D chrome/browser/download/download_file_picker_chromeos.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -78 lines 0 comments Download
M chrome/browser/download/download_prefs.h View 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/download/download_prefs.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -2 lines 0 comments Download
A chrome/browser/download/download_target_determiner.h View 1 2 3 4 5 6 7 1 chunk +252 lines, -0 lines 0 comments Download
A chrome/browser/download/download_target_determiner.cc View 1 2 3 4 5 6 7 8 9 1 chunk +594 lines, -0 lines 0 comments Download
A chrome/browser/download/download_target_determiner_delegate.h View 1 2 3 4 5 6 1 chunk +110 lines, -0 lines 0 comments Download
A chrome/browser/download/download_target_determiner_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1473 lines, -0 lines 0 comments Download
M chrome/browser/download/download_test_file_activity_observer.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
asanka
Randy: Sorry to drop this on you. Could you do a high level glance over?
7 years, 8 months ago (2013-04-06 01:21:49 UTC) #1
Randy Smith (Not in Mondays)
Very high level opinion: I think this makes sense. Download file name determination has gotten ...
7 years, 8 months ago (2013-04-08 15:39:33 UTC) #2
asanka
Thanks! Could you do the next round? I updated the CL description to call out ...
7 years, 8 months ago (2013-04-08 22:44:57 UTC) #3
benjhayden
https://codereview.chromium.org/12850002/diff/9001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/12850002/diff/9001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode162 chrome/browser/download/chrome_download_manager_delegate.cc:162: // TODO(asanka): This determination is done based on |path|, ...
7 years, 8 months ago (2013-04-09 15:46:32 UTC) #4
Randy Smith (Not in Mondays)
Next round. Two high level comments: * Relying on you and Ben to get the ...
7 years, 8 months ago (2013-04-09 19:32:17 UTC) #5
asanka
This is more of an interim patchset, since I want to solicit opinions testability before ...
7 years, 8 months ago (2013-04-16 20:34:01 UTC) #6
benjhayden
I think that I would vote for finer grained delegate methods like NotifyExtensions() in general ...
7 years, 8 months ago (2013-04-18 17:33:46 UTC) #7
asanka
Can you take another look at the DownloadTargetDeterminerDelegate interface? I've changed it to use finer ...
7 years, 8 months ago (2013-04-24 23:16:30 UTC) #8
benjhayden
The approach looks good. Is there anything else you want to do to the CL ...
7 years, 8 months ago (2013-04-25 17:16:04 UTC) #9
Randy Smith (Not in Mondays)
7 years, 8 months ago (2013-04-25 17:25:45 UTC) #10
Randy Smith (Not in Mondays)
On 2013/04/25 17:25:45, rdsmith wrote: Whoops, but in Rietveld. The new interface looks basically good ...
7 years, 8 months ago (2013-04-25 17:32:28 UTC) #11
asanka
Thanks for the high level reviews. Since the approach looks okay I'd request a detailed ...
7 years, 8 months ago (2013-04-25 19:08:26 UTC) #12
benjhayden
https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode499 chrome/browser/download/chrome_download_manager_delegate.cc:499: callback.Run(virtual_path); Is the callback necessary? This looks like a ...
7 years, 8 months ago (2013-04-26 15:07:37 UTC) #13
asanka
https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode499 chrome/browser/download/chrome_download_manager_delegate.cc:499: callback.Run(virtual_path); On 2013/04/26 15:07:37, benjhayden_chromium wrote: > Is the ...
7 years, 8 months ago (2013-04-26 17:02:21 UTC) #14
benjhayden
LGTM, one nit. Please wait for Randy. https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/download_target_determiner.cc File chrome/browser/download/download_target_determiner.cc (right): https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/download_target_determiner.cc#newcode181 chrome/browser/download/download_target_determiner.cc:181: if (!download_->IsInProgress()) ...
7 years, 8 months ago (2013-04-26 17:25:55 UTC) #15
Randy Smith (Not in Mondays)
I like it. LGTM with the comment request below; the rest are up to you. ...
7 years, 8 months ago (2013-04-26 19:05:45 UTC) #16
asanka
Thanks for the reviews! https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/download_target_determiner.cc File chrome/browser/download/download_target_determiner.cc (right): https://codereview.chromium.org/12850002/diff/53001/chrome/browser/download/download_target_determiner.cc#newcode181 chrome/browser/download/download_target_determiner.cc:181: if (!download_->IsInProgress()) On 2013/04/26 17:25:56, ...
7 years, 7 months ago (2013-04-29 18:43:19 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asanka@chromium.org/12850002/87001
7 years, 7 months ago (2013-04-30 16:54:30 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asanka@chromium.org/12850002/107001
7 years, 7 months ago (2013-04-30 21:41:04 UTC) #19
commit-bot: I haz the power
7 years, 7 months ago (2013-05-01 00:03:39 UTC) #20
Message was sent while issue was closed.
Change committed as 197518

Powered by Google App Engine
This is Rietveld 408576698