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

Unified Diff: chrome/browser/download/download_target_determiner.cc

Issue 2618743006: Use previous target path when resuming a download after crash (Closed)
Patch Set: add code for test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/download/download_target_determiner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_target_determiner.cc
diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc
index 8949f08ddd9b0283f76a7eb7ee46dfc7f3ec423f..5c071c7e0563fd029d4b321b247d758380d87581 100644
--- a/chrome/browser/download/download_target_determiner.cc
+++ b/chrome/browser/download/download_target_determiner.cc
@@ -207,7 +207,6 @@ DownloadTargetDeterminer::Result
// (WebStore, Drag&Drop). Treat the path as a virtual path. We will
// eventually determine whether this is a local path and if not, figure out
// a local path.
-
std::string suggested_filename = download_->GetSuggestedFilename();
if (suggested_filename.empty() &&
download_->GetMimeType() == "application/x-x509-user-cert") {
@@ -233,12 +232,18 @@ DownloadTargetDeterminer::Result
} else {
target_directory = download_prefs_->DownloadPath();
}
- virtual_path_ = target_directory.Append(generated_filename);
#if defined(OS_ANDROID)
- conflict_action_ = DownloadPathReservationTracker::PROMPT;
+ // If |virtual_path_| is not empty, we are resuming a download which already
+ // has a target path. Don't prompt user in this case.
+ if (!virtual_path_.empty()) {
+ conflict_action_ = DownloadPathReservationTracker::UNIQUIFY;
+ } else {
+ conflict_action_ = DownloadPathReservationTracker::PROMPT;
+ }
#else
conflict_action_ = DownloadPathReservationTracker::UNIQUIFY;
#endif
+ virtual_path_ = target_directory.Append(generated_filename);
should_notify_extensions_ = true;
} else {
virtual_path_ = download_->GetForcedFilePath();
@@ -620,7 +625,6 @@ void DownloadTargetDeterminer::CheckDownloadUrlDone(
DownloadTargetDeterminer::Result
DownloadTargetDeterminer::DoCheckVisitedReferrerBefore() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
next_state_ = STATE_DETERMINE_INTERMEDIATE_PATH;
// Checking if there are prior visits to the referrer is only necessary if the
« no previous file with comments | « no previous file | chrome/browser/download/download_target_determiner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698