| 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 e36ed85f7feedd7ba9b28d3fccf2de0386ed8712..c3aa96086756d847e1c5d6509157a4893bb51e3e 100644
|
| --- a/chrome/browser/download/chrome_download_manager_delegate.cc
|
| +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
|
| @@ -42,6 +42,8 @@
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/features.h"
|
| #include "chrome/common/pref_names.h"
|
| +#include "chrome/common/safe_browsing/file_type_policies.h"
|
| +#include "chrome/grit/generated_resources.h"
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "components/prefs/pref_member.h"
|
| #include "components/prefs/pref_service.h"
|
| @@ -51,6 +53,7 @@
|
| #include "content/public/browser/page_navigator.h"
|
| #include "net/base/filename_util.h"
|
| #include "net/base/mime_util.h"
|
| +#include "ui/base/l10n/l10n_util.h"
|
|
|
| #if BUILDFLAG(ANDROID_JAVA_UI)
|
| #include "chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.h"
|
| @@ -432,6 +435,20 @@ void ChromeDownloadManagerDelegate::ChooseSavePath(
|
| callback);
|
| }
|
|
|
| +void ChromeDownloadManagerDelegate::SanitizeSavePackageResourceName(
|
| + base::FilePath* filename) {
|
| + safe_browsing::FileTypePolicies* file_type_policies =
|
| + safe_browsing::FileTypePolicies::GetInstance();
|
| +
|
| + if (file_type_policies->GetFileDangerLevel(*filename) ==
|
| + safe_browsing::DownloadFileType::NOT_DANGEROUS)
|
| + return;
|
| +
|
| + base::FilePath default_filename = base::FilePath::FromUTF8Unsafe(
|
| + l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
|
| + *filename = filename->AddExtension(default_filename.BaseName().value());
|
| +}
|
| +
|
| void ChromeDownloadManagerDelegate::OpenDownloadUsingPlatformHandler(
|
| DownloadItem* download) {
|
| base::FilePath platform_path(
|
|
|