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

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

Issue 565053002: [Downloads] Gracefully handle SafeBrowsing check failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 296ae5e45ccb13d71d1d493e5ea4f4cea1e168a4..1876f08e57daa233f73576514e1deadaf49a6aca 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -159,7 +159,8 @@ void CheckDownloadUrlDone(
bool is_content_check_supported,
DownloadProtectionService::DownloadCheckResult result) {
content::DownloadDangerType danger_type;
- if (result == DownloadProtectionService::SAFE) {
+ if (result == DownloadProtectionService::SAFE ||
+ result == DownloadProtectionService::UNKNOWN) {
// If this type of files is handled by the enhanced SafeBrowsing download
// protection, mark it as potentially dangerous content until we are done
// with scanning it.
@@ -636,6 +637,11 @@ void ChromeDownloadManagerDelegate::CheckClientDownloadDone(
content::DownloadDangerType danger_type =
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS;
switch (result) {
+ case DownloadProtectionService::UNKNOWN:
+ // The check failed or was inconclusive.
+ if (DownloadItemModel(item).IsDangerousFileBasedOnType())
+ danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE;
+ break;
case DownloadProtectionService::SAFE:
// Do nothing.
break;
@@ -688,10 +694,15 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
scoped_ptr<DownloadTargetInfo> target_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DownloadItem* item = download_manager_->GetDownload(download_id);
- if (!target_info->target_path.empty() && item &&
- IsOpenInBrowserPreferreredForFile(target_info->target_path) &&
- target_info->is_filetype_handled_safely)
- DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true);
+ if (item) {
+ if (!target_info->target_path.empty() &&
+ IsOpenInBrowserPreferreredForFile(target_info->target_path) &&
+ target_info->is_filetype_handled_safely)
+ DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true);
+
+ if (target_info->is_dangerous_file)
+ DownloadItemModel(item).SetIsDangerousFileBasedOnType(true);
+ }
callback.Run(target_info->target_path,
target_info->target_disposition,
target_info->danger_type,

Powered by Google App Engine
This is Rietveld 408576698