Chromium Code Reviews| 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 fbc35cfeef8854132e5eca8142f25ca88397ccbe..e1e55f68cf9b29a995847aa6dfcacdb459530cc0 100644 |
| --- a/chrome/browser/download/download_target_determiner.cc |
| +++ b/chrome/browser/download/download_target_determiner.cc |
| @@ -191,16 +191,18 @@ DownloadTargetDeterminer::Result |
| DCHECK(!should_prompt_); |
| DCHECK(!should_notify_extensions_); |
| DCHECK_EQ(DownloadPathReservationTracker::OVERWRITE, conflict_action_); |
| - bool is_forced_path = !download_->GetForcedFilePath().empty(); |
| + // If the download already has a forced path or a target path, use it. |
| + bool has_target_path = !download_->GetForcedFilePath().empty() |
| + || !download_->GetTargetFilePath().empty(); |
| next_state_ = STATE_NOTIFY_EXTENSIONS; |
| - if (!virtual_path_.empty() && HasPromptedForPath() && !is_forced_path) { |
| + if (!virtual_path_.empty() && HasPromptedForPath() && !has_target_path) { |
| // The download is being resumed and the user has already been prompted for |
| // a path. Assume that it's okay to overwrite the file if there's a conflict |
| // and reuse the selection. |
| should_prompt_ = ShouldPromptForDownload(virtual_path_); |
| - } else if (!is_forced_path) { |
| + } else if (!has_target_path) { |
| // If we don't have a forced path, we should construct a path for the |
| // download. Forced paths are only specified for programmatic downloads |
| // (WebStore, Drag&Drop). Treat the path as a virtual path. We will |
| @@ -240,7 +242,8 @@ DownloadTargetDeterminer::Result |
| #endif |
| should_notify_extensions_ = true; |
| } else { |
| - virtual_path_ = download_->GetForcedFilePath(); |
| + virtual_path_ = download_->GetForcedFilePath().empty() ? |
|
David Trainor- moved to gerrit
2017/01/06 23:26:41
Since we're using this logic a lot, would it be cl
qinmin
2017/01/09 22:17:27
Done.
|
| + download_->GetTargetFilePath() : download_->GetForcedFilePath(); |
| // If this is a resumed download which was previously interrupted due to an |
| // issue with the forced path, the user is still not prompted. If the path |
| // supplied to a programmatic download is invalid, then the caller needs to |