[MIX-DL] Refactor for future mixed-content download blocking UIs.
This CL changes the mixed content download blocking code to return an
enum indicating what type of blocking should be used (silent, or two
types of blocking UI). Previously, this function returned a boolean that
indicated silent blocking. The CL then propagates that result through
the DownloadTargetDeterminer into the DownloadItem. That state is needed
later to trigger the existing download shelf warning UI.
This CL also renames callbacks in/around the DownloadTargetDeterminer
from "ShouldBlock"-type names to "GetMixedContentStatus"-type names.
This CL causes no functional change to Chrome. Follow-up CLs will add
support for, then trigger, user-visible warnings.
This is part of go/downloads-as-mixed-content .
Bug: 960819
Change-Id: Ic0c3f41caf7e623050d4b75be364f410a46e296d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1982680
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Evan Stade <[email protected]>
Reviewed-by: Sean Topping <[email protected]>
Reviewed-by: Min Qin <[email protected]>
Commit-Queue: Joe DeBlasio <[email protected]>
Cr-Commit-Position: refs/heads/master@{#732954}
diff --git a/content/shell/browser/shell_download_manager_delegate.cc b/content/shell/browser/shell_download_manager_delegate.cc
index 0b6a17f..f104513 100644
--- a/content/shell/browser/shell_download_manager_delegate.cc
+++ b/content/shell/browser/shell_download_manager_delegate.cc
@@ -75,6 +75,7 @@
download->GetForcedFilePath(),
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
+ download::DownloadItem::MixedContentStatus::UNKNOWN,
download->GetForcedFilePath(),
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
@@ -140,6 +141,7 @@
std::move(callback).Run(
suggested_path, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
+ download::DownloadItem::MixedContentStatus::UNKNOWN,
suggested_path.AddExtension(FILE_PATH_LITERAL(".crdownload")),
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return;
@@ -190,8 +192,9 @@
std::move(callback).Run(result,
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
- download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result,
- download::DOWNLOAD_INTERRUPT_REASON_NONE);
+ download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
+ download::DownloadItem::MixedContentStatus::UNKNOWN,
+ result, download::DOWNLOAD_INTERRUPT_REASON_NONE);
}
void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting(