[downloads] Allow download target determination to indicate an error.

https://chromium-review.googlesource.com/c/465526/
This commit is contained in:
Aleksei Kuzmin 2017-06-17 00:57:28 +03:00
parent 7c7300ff82
commit 0adc887b32

View file

@ -115,7 +115,10 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
// If user cancels the file save dialog, run the callback with empty FilePath.
callback.Run(path,
content::DownloadItem::TARGET_DISPOSITION_PROMPT,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path);
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
path.empty() ?
content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED :
content::DOWNLOAD_INTERRUPT_REASON_NONE);
}
void AtomDownloadManagerDelegate::Shutdown() {
@ -132,7 +135,8 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
callback.Run(download->GetForcedFilePath(),
content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download->GetForcedFilePath());
download->GetForcedFilePath(),
content::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@ -143,7 +147,7 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
callback.Run(save_path,
content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
save_path);
save_path, content::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}