From 0adc887b326a3e45102344c79374d209d7700f38 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Sat, 17 Jun 2017 00:57:28 +0300 Subject: [PATCH] [downloads] Allow download target determination to indicate an error. https://chromium-review.googlesource.com/c/465526/ --- atom/browser/atom_download_manager_delegate.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/atom/browser/atom_download_manager_delegate.cc b/atom/browser/atom_download_manager_delegate.cc index ccbc43416a12..6552a08df6c0 100644 --- a/atom/browser/atom_download_manager_delegate.cc +++ b/atom/browser/atom_download_manager_delegate.cc @@ -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; }