12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241 |
- --- a/chrome/browser/BUILD.gn
- +++ b/chrome/browser/BUILD.gn
- @@ -2388,7 +2388,6 @@ static_library("browser") {
- "//components/reporting/util:task_runner_context",
- "//components/resources",
- "//components/safe_browsing/content/browser",
- - "//components/safe_browsing/content/browser:client_side_detection",
- "//components/safe_browsing/content/browser:safe_browsing_service",
- "//components/safe_browsing/content/browser/password_protection",
- "//components/safe_browsing/content/browser/web_ui",
- @@ -3809,8 +3808,6 @@ static_library("browser") {
- "download/download_commands.h",
- "download/download_crx_util.cc",
- "download/download_crx_util.h",
- - "download/download_danger_prompt.cc",
- - "download/download_danger_prompt.h",
- "download/download_dir_policy_handler.cc",
- "download/download_dir_policy_handler.h",
- "download/download_dir_util.cc",
- --- a/chrome/browser/browser_process.h
- +++ b/chrome/browser/browser_process.h
- @@ -55,10 +55,6 @@ class NetworkQualityTracker;
- class SharedURLLoaderFactory;
- }
-
- -namespace safe_browsing {
- -class SafeBrowsingService;
- -}
- -
- namespace subresource_filter {
- class RulesetService;
- }
- @@ -219,9 +215,6 @@ class BrowserProcess {
- // on this platform (or this is a unit test).
- virtual StatusTray* status_tray() = 0;
-
- - // Returns the SafeBrowsing service.
- - virtual safe_browsing::SafeBrowsingService* safe_browsing_service() = 0;
- -
- // Returns the service providing versioned storage for rules used by the Safe
- // Browsing subresource filter.
- virtual subresource_filter::RulesetService*
- --- a/chrome/browser/browser_process_impl.cc
- +++ b/chrome/browser/browser_process_impl.cc
- @@ -71,7 +71,6 @@
- #include "chrome/browser/printing/print_job_manager.h"
- #include "chrome/browser/profiles/profile_manager.h"
- #include "chrome/browser/resource_coordinator/resource_coordinator_parts.h"
- -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
- #include "chrome/browser/shell_integration.h"
- #include "chrome/browser/site_isolation/prefs_observer.h"
- #include "chrome/browser/ssl/secure_origin_prefs_observer.h"
- @@ -436,8 +435,6 @@ void BrowserProcessImpl::StartTearDown()
- #endif
- metrics_services_manager_.reset();
- intranet_redirect_detector_.reset();
- - if (safe_browsing_service_.get())
- - safe_browsing_service()->ShutDown();
- network_time_tracker_.reset();
-
- #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
- @@ -1084,14 +1081,6 @@ StatusTray* BrowserProcessImpl::status_t
- return status_tray_.get();
- }
-
- -safe_browsing::SafeBrowsingService*
- -BrowserProcessImpl::safe_browsing_service() {
- - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- - if (!created_safe_browsing_service_)
- - CreateSafeBrowsingService();
- - return safe_browsing_service_.get();
- -}
- -
- subresource_filter::RulesetService*
- BrowserProcessImpl::subresource_filter_ruleset_service() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- @@ -1336,26 +1325,6 @@ void BrowserProcessImpl::CreateBackgroun
- #endif
- }
-
- -void BrowserProcessImpl::CreateSafeBrowsingService() {
- - DCHECK(!safe_browsing_service_);
- - // Set this flag to true so that we don't retry indefinitely to
- - // create the service class if there was an error.
- - created_safe_browsing_service_ = true;
- -
- - // The factory can be overridden in tests.
- - if (!safe_browsing::SafeBrowsingServiceInterface::HasFactory()) {
- - safe_browsing::SafeBrowsingServiceInterface::RegisterFactory(
- - safe_browsing::GetSafeBrowsingServiceFactory());
- - }
- -
- - // TODO(crbug/925153): Port consumers of the |safe_browsing_service_| to use
- - // the interface in components/safe_browsing, and remove this cast.
- - safe_browsing_service_ = static_cast<safe_browsing::SafeBrowsingService*>(
- - safe_browsing::SafeBrowsingServiceInterface::CreateSafeBrowsingService());
- - if (safe_browsing_service_)
- - safe_browsing_service_->Initialize();
- -}
- -
- void BrowserProcessImpl::CreateSubresourceFilterRulesetService() {
- DCHECK(!subresource_filter_ruleset_service_);
- created_subresource_filter_ruleset_service_ = true;
- --- a/chrome/browser/browser_process_impl.h
- +++ b/chrome/browser/browser_process_impl.h
- @@ -195,7 +195,6 @@ class BrowserProcessImpl : public Browse
- std::unique_ptr<BackgroundModeManager> manager) override;
- #endif
- StatusTray* status_tray() override;
- - safe_browsing::SafeBrowsingService* safe_browsing_service() override;
- subresource_filter::RulesetService* subresource_filter_ruleset_service()
- override;
-
- @@ -355,9 +354,6 @@ class BrowserProcessImpl : public Browse
- std::unique_ptr<BackgroundModeManager> background_mode_manager_;
- #endif
-
- - bool created_safe_browsing_service_ = false;
- - scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service_;
- -
- bool created_subresource_filter_ruleset_service_ = false;
- std::unique_ptr<subresource_filter::RulesetService>
- subresource_filter_ruleset_service_;
- --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
- +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
- @@ -66,7 +66,6 @@
- #include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
- #include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
- #include "chrome/browser/profiles/profile.h"
- -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
- #include "chrome/browser/safe_browsing/verdict_cache_manager_factory.h"
- #include "chrome/browser/search_engines/template_url_service_factory.h"
- #include "chrome/browser/share/share_history.h"
- @@ -627,10 +626,6 @@ void ChromeBrowsingDataRemoverDelegate::
- base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies"));
-
- network::mojom::NetworkContext* safe_browsing_context = nullptr;
- - safe_browsing::SafeBrowsingService* sb_service =
- - g_browser_process->safe_browsing_service();
- - if (sb_service)
- - safe_browsing_context = sb_service->GetNetworkContext(profile_);
-
- // Cleared for DATA_TYPE_HISTORY, DATA_TYPE_COOKIES and DATA_TYPE_PASSWORDS.
- browsing_data::RemoveFederatedSiteSettingsData(delete_begin_, delete_end_,
- --- a/chrome/browser/chrome_content_browser_client.cc
- +++ b/chrome/browser/chrome_content_browser_client.cc
- @@ -1063,34 +1063,6 @@ void SetApplicationLocaleOnIOThread(cons
- GetIOThreadApplicationLocale() = locale;
- }
-
- -// An implementation of the SSLCertReporter interface used by
- -// SSLErrorHandler. Uses CertificateReportingService to send reports. The
- -// service handles queueing and re-sending of failed reports. Each certificate
- -// error creates a new instance of this class.
- -class CertificateReportingServiceCertReporter : public SSLCertReporter {
- - public:
- - explicit CertificateReportingServiceCertReporter(
- - content::WebContents* web_contents)
- - : service_(CertificateReportingServiceFactory::GetForBrowserContext(
- - web_contents->GetBrowserContext())) {}
- -
- - CertificateReportingServiceCertReporter(
- - const CertificateReportingServiceCertReporter&) = delete;
- - CertificateReportingServiceCertReporter& operator=(
- - const CertificateReportingServiceCertReporter&) = delete;
- -
- - ~CertificateReportingServiceCertReporter() override {}
- -
- - // SSLCertReporter implementation
- - void ReportInvalidCertificateChain(
- - const std::string& serialized_report) override {
- - service_->Send(serialized_report);
- - }
- -
- - private:
- - raw_ptr<CertificateReportingService> service_;
- -};
- -
- #if BUILDFLAG(ENABLE_EXTENSIONS)
-
- AppLoadedInTabSource ClassifyAppLoadedInTabSource(
- @@ -5201,14 +5173,9 @@ ChromeContentBrowserClient::CreateThrott
- throttles.push_back(std::make_unique<PolicyBlocklistNavigationThrottle>(
- handle, handle->GetWebContents()->GetBrowserContext()));
-
- - // Before setting up SSL error detection, configure SSLErrorHandler to invoke
- - // the relevant extension API whenever an SSL interstitial is shown.
- - SSLErrorHandler::SetClientCallbackOnInterstitialsShown(
- - base::BindRepeating(&MaybeTriggerSecurityInterstitialShownEvent));
- - content::WebContents* web_contents = handle->GetWebContents();
- throttles.push_back(std::make_unique<SSLErrorNavigationThrottle>(
- handle,
- - std::make_unique<CertificateReportingServiceCertReporter>(web_contents),
- + nullptr,
- base::BindOnce(&HandleSSLErrorWrapper), base::BindOnce(&IsInHostedApp),
- base::BindOnce(
- &ShouldIgnoreSslInterstitialBecauseNavigationDefaultedToHttps)));
- @@ -5254,16 +5221,6 @@ ChromeContentBrowserClient::CreateThrott
- &throttles);
- #endif
-
- - // g_browser_process->safe_browsing_service() may be null in unittests.
- - safe_browsing::SafeBrowsingUIManager* ui_manager =
- - g_browser_process->safe_browsing_service()
- - ? g_browser_process->safe_browsing_service()->ui_manager().get()
- - : nullptr;
- - MaybeAddThrottle(
- - safe_browsing::SafeBrowsingNavigationThrottle::MaybeCreateThrottleFor(
- - handle, ui_manager),
- - &throttles);
- -
- if (base::FeatureList::IsEnabled(safe_browsing::kDelayedWarnings)) {
- throttles.push_back(
- std::make_unique<safe_browsing::DelayedWarningNavigationThrottle>(
- @@ -5542,8 +5499,6 @@ void ChromeContentBrowserClient::Overrid
- void ChromeContentBrowserClient::InitOnUIThread() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- - safe_browsing_service_ = g_browser_process->safe_browsing_service();
- -
- // Initialize `network_contexts_parent_directory_`.
- base::FilePath user_data_dir;
- base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- --- a/chrome/browser/component_updater/file_type_policies_component_installer.cc
- +++ b/chrome/browser/component_updater/file_type_policies_component_installer.cc
- @@ -38,20 +38,6 @@ const uint8_t kFileTypePoliciesPublicKey
- const char kFileTypePoliciesManifestName[] = "File Type Policies";
-
- void LoadFileTypesFromDisk(const base::FilePath& pb_path) {
- - if (pb_path.empty())
- - return;
- -
- - VLOG(1) << "Reading Download File Types from file: " << pb_path.value();
- - std::string binary_pb;
- - if (!base::ReadFileToString(pb_path, &binary_pb)) {
- - // The file won't exist on new installations, so this is not always an
- - // error.
- - VLOG(1) << "Failed reading from " << pb_path.value();
- - return;
- - }
- -
- - safe_browsing::FileTypePolicies::GetInstance()->PopulateFromDynamicUpdate(
- - binary_pb);
- }
-
- } // namespace
- --- a/chrome/browser/download/chrome_download_manager_delegate.cc
- +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
- @@ -473,13 +473,6 @@ void ChromeDownloadManagerDelegate::SetD
-
- download_manager_ = dm;
-
- - safe_browsing::SafeBrowsingService* sb_service =
- - g_browser_process->safe_browsing_service();
- - if (sb_service && !profile_->IsOffTheRecord()) {
- - // Include this download manager in the set monitored by safe browsing.
- - sb_service->AddDownloadManager(dm);
- - }
- -
- if (download_manager_) {
- download_manager_->AddObserver(this);
- }
- @@ -875,17 +868,6 @@ void ChromeDownloadManagerDelegate::Choo
- void ChromeDownloadManagerDelegate::SanitizeSavePackageResourceName(
- base::FilePath* filename,
- const GURL& source_url) {
- - safe_browsing::FileTypePolicies* file_type_policies =
- - safe_browsing::FileTypePolicies::GetInstance();
- -
- - const PrefService* prefs = profile_->GetPrefs();
- - if (file_type_policies->GetFileDangerLevel(*filename, source_url, prefs) ==
- - 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::SanitizeDownloadParameters(
- --- a/chrome/browser/download/download_item_model.cc
- +++ b/chrome/browser/download/download_item_model.cc
- @@ -109,7 +109,7 @@ class DownloadItemModelData : public bas
-
- // Danger level of the file determined based on the file type and whether
- // there was a user action associated with the download.
- - DownloadFileType::DangerLevel danger_level_;
- + safe_browsing::DownloadFileType::DangerLevel danger_level_;
-
- // Whether the download is currently being revived.
- bool is_being_revived_;
- @@ -159,7 +159,7 @@ DownloadItemModelData* DownloadItemModel
- DownloadItemModelData::DownloadItemModelData()
- : should_show_in_shelf_(true),
- was_ui_notified_(false),
- - danger_level_(DownloadFileType::NOT_DANGEROUS),
- + danger_level_(safe_browsing::DownloadFileType::NOT_DANGEROUS),
- is_being_revived_(false) {}
-
- #if BUILDFLAG(FULL_SAFE_BROWSING)
- @@ -534,13 +534,13 @@ void DownloadItemModel::SetShouldPreferO
- data->should_prefer_opening_in_browser_ = preference;
- }
-
- -DownloadFileType::DangerLevel DownloadItemModel::GetDangerLevel() const {
- +safe_browsing::DownloadFileType::DangerLevel DownloadItemModel::GetDangerLevel() const {
- const DownloadItemModelData* data = DownloadItemModelData::Get(download_);
- - return data ? data->danger_level_ : DownloadFileType::NOT_DANGEROUS;
- + return data ? data->danger_level_ : safe_browsing::DownloadFileType::NOT_DANGEROUS;
- }
-
- void DownloadItemModel::SetDangerLevel(
- - DownloadFileType::DangerLevel danger_level) {
- + safe_browsing::DownloadFileType::DangerLevel danger_level) {
- DownloadItemModelData* data = DownloadItemModelData::GetOrCreate(download_);
- data->danger_level_ = danger_level;
- }
- @@ -717,9 +717,6 @@ bool DownloadItemModel::IsCommandEnabled
- // filename. Don't base an "Always open" decision based on it. Also
- // exclude extensions.
- return download_->CanOpenDownload() &&
- - safe_browsing::FileTypePolicies::GetInstance()
- - ->IsAllowedToOpenAutomatically(
- - download_->GetTargetFilePath()) &&
- !download_crx_util::IsExtensionDownload(*download_);
- case DownloadCommands::PAUSE:
- return !download_->IsSavePackageDownload() &&
- --- a/chrome/browser/download/download_prefs.cc
- +++ b/chrome/browser/download/download_prefs.cc
- @@ -263,14 +263,7 @@ DownloadPrefs::DownloadPrefs(Profile* pr
- base::FilePath::StringType(1, base::FilePath::kExtensionSeparator) +
- extension);
-
- - // Note that the list of file types that are not allowed to open
- - // automatically can change in the future. When the list is tightened, it is
- - // expected that some entries in the users' auto open list will get dropped
- - // permanently as a result.
- - if (FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically(
- - filename_with_extension)) {
- - auto_open_by_user_.insert(extension);
- - }
- + auto_open_by_user_.insert(extension);
- }
- }
-
- @@ -449,10 +442,6 @@ bool DownloadPrefs::IsAutoOpenByPolicy(c
- bool DownloadPrefs::EnableAutoOpenByUserBasedOnExtension(
- const base::FilePath& file_name) {
- base::FilePath::StringType extension = file_name.Extension();
- - if (!FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically(
- - file_name)) {
- - return false;
- - }
-
- DCHECK(extension[0] == base::FilePath::kExtensionSeparator);
- extension.erase(0, 1);
- --- a/chrome/browser/download/download_target_determiner.cc
- +++ b/chrome/browser/download/download_target_determiner.cc
- @@ -323,13 +323,6 @@ base::FilePath DownloadTargetDeterminer:
- download_->GetURL(), download_->GetContentDisposition(), referrer_charset,
- suggested_filename, sniffed_mime_type, default_filename);
-
- - // We don't replace the file extension if sfafe browsing consider the file
- - // extension to be unsafe. Just let safe browsing scan the generated file.
- - if (safe_browsing::FileTypePolicies::GetInstance()->IsCheckedBinaryFile(
- - generated_filename)) {
- - return generated_filename;
- - }
- -
- // If no mime type or explicitly specified a name, don't replace file
- // extension.
- if (sniffed_mime_type.empty() || !suggested_filename.empty())
- @@ -1272,30 +1265,7 @@ DownloadFileType::DangerLevel DownloadTa
- download_->HasUserGesture())
- return DownloadFileType::NOT_DANGEROUS;
-
- - DownloadFileType::DangerLevel danger_level =
- - safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
- - virtual_path_.BaseName(), download_->GetURL(),
- - GetProfile()->GetPrefs());
- -
- - // A danger level of ALLOW_ON_USER_GESTURE is used to label potentially
- - // dangerous file types that have a high frequency of legitimate use. We would
- - // like to avoid prompting for the legitimate cases as much as possible. To
- - // that end, we consider a download to be legitimate if one of the following
- - // is true, and avoid prompting:
- - //
- - // * The user navigated to the download URL via the omnibox (either by typing
- - // the URL, pasting it, or using search).
- - //
- - // * The navigation that initiated the download has a user gesture associated
- - // with it AND the user the user is familiar with the referring origin. A
- - // user is considered familiar with a referring origin if a visit for a page
- - // from the same origin was recorded on the previous day or earlier.
- - if (danger_level == DownloadFileType::ALLOW_ON_USER_GESTURE &&
- - ((download_->GetTransitionType() &
- - ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) != 0 ||
- - (download_->HasUserGesture() && visits == VISITED_REFERRER)))
- - return DownloadFileType::NOT_DANGEROUS;
- - return danger_level;
- + return DownloadFileType::NOT_DANGEROUS;
- }
-
- absl::optional<base::Time>
- --- a/chrome/browser/extensions/api/downloads/downloads_api.cc
- +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
- @@ -37,7 +37,6 @@
- #include "chrome/browser/download/bubble/download_bubble_ui_controller.h"
- #include "chrome/browser/download/download_core_service.h"
- #include "chrome/browser/download/download_core_service_factory.h"
- -#include "chrome/browser/download/download_danger_prompt.h"
- #include "chrome/browser/download/download_file_icon_extractor.h"
- #include "chrome/browser/download/download_open_prompt.h"
- #include "chrome/browser/download/download_prefs.h"
- @@ -1368,9 +1367,6 @@ DownloadsAcceptDangerFunction::Downloads
-
- DownloadsAcceptDangerFunction::~DownloadsAcceptDangerFunction() {}
-
- -DownloadsAcceptDangerFunction::OnPromptCreatedCallback*
- - DownloadsAcceptDangerFunction::on_prompt_created_ = nullptr;
- -
- ExtensionFunction::ResponseAction DownloadsAcceptDangerFunction::Run() {
- absl::optional<downloads::AcceptDanger::Params> params =
- downloads::AcceptDanger::Params::Create(args());
- @@ -1408,42 +1404,7 @@ void DownloadsAcceptDangerFunction::Prom
- return;
- }
- RecordApiFunctions(DOWNLOADS_FUNCTION_ACCEPT_DANGER);
- - // DownloadDangerPrompt displays a modal dialog using native widgets that the
- - // user must either accept or cancel. It cannot be scripted.
- - DownloadDangerPrompt* prompt = DownloadDangerPrompt::Create(
- - download_item, web_contents, true,
- - base::BindOnce(&DownloadsAcceptDangerFunction::DangerPromptCallback, this,
- - download_id));
- - // DownloadDangerPrompt deletes itself
- - if (on_prompt_created_ && !on_prompt_created_->is_null())
- - std::move(*on_prompt_created_).Run(prompt);
- - // Function finishes in DangerPromptCallback().
- -}
- -
- -void DownloadsAcceptDangerFunction::DangerPromptCallback(
- - int download_id,
- - DownloadDangerPrompt::Action action) {
- - DCHECK_CURRENTLY_ON(BrowserThread::UI);
- - DownloadItem* download_item = GetDownload(
- - browser_context(), include_incognito_information(), download_id);
- - std::string error;
- - if (InvalidId(download_item, &error) ||
- - Fault(download_item->GetState() != DownloadItem::IN_PROGRESS,
- - download_extension_errors::kNotInProgress, &error)) {
- - Respond(Error(std::move(error)));
- - return;
- - }
- - switch (action) {
- - case DownloadDangerPrompt::ACCEPT:
- - download_item->ValidateDangerousDownload();
- - break;
- - case DownloadDangerPrompt::CANCEL:
- - download_item->Remove();
- - break;
- - case DownloadDangerPrompt::DISMISS:
- - break;
- - }
- - Respond(NoArguments());
- + download_item->ValidateDangerousDownload();
- }
-
- DownloadsShowFunction::DownloadsShowFunction() {}
- --- a/chrome/browser/extensions/api/downloads/downloads_api.h
- +++ b/chrome/browser/extensions/api/downloads/downloads_api.h
- @@ -13,7 +13,6 @@
- #include "base/memory/raw_ptr.h"
- #include "base/scoped_observation.h"
- #include "base/time/time.h"
- -#include "chrome/browser/download/download_danger_prompt.h"
- #include "chrome/common/extensions/api/downloads.h"
- #include "components/download/content/public/all_download_item_notifier.h"
- #include "components/download/public/common/download_path_reservation_tracker.h"
- @@ -201,13 +200,6 @@ class DownloadsRemoveFileFunction : publ
-
- class DownloadsAcceptDangerFunction : public ExtensionFunction {
- public:
- - using OnPromptCreatedCallback =
- - base::OnceCallback<void(DownloadDangerPrompt*)>;
- - static void OnPromptCreatedForTesting(
- - OnPromptCreatedCallback* callback) {
- - on_prompt_created_ = callback;
- - }
- -
- DECLARE_EXTENSION_FUNCTION("downloads.acceptDanger", DOWNLOADS_ACCEPTDANGER)
- DownloadsAcceptDangerFunction();
-
- @@ -219,13 +211,10 @@ class DownloadsAcceptDangerFunction : pu
-
- protected:
- ~DownloadsAcceptDangerFunction() override;
- - void DangerPromptCallback(int download_id,
- - DownloadDangerPrompt::Action action);
-
- private:
- void PromptOrWait(int download_id, int retries);
-
- - static OnPromptCreatedCallback* on_prompt_created_;
- };
-
- class DownloadsShowFunction : public ExtensionFunction {
- --- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
- +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
- @@ -53,39 +53,7 @@ SafeBrowsingPrivateGetReferrerChainFunct
- base::StringPrintf("Could not find tab with id %d.", params->tab_id)));
- }
-
- - Profile* profile = Profile::FromBrowserContext(browser_context());
- - if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(
- - profile->GetPrefs(), g_browser_process->safe_browsing_service()))
- - return RespondNow(NoArguments());
- -
- - SafeBrowsingNavigationObserverManager* navigation_observer_manager =
- - safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- - GetForBrowserContext(profile);
- -
- - safe_browsing::ReferrerChain referrer_chain;
- - SafeBrowsingNavigationObserverManager::AttributionResult result =
- - navigation_observer_manager->IdentifyReferrerChainByRenderFrameHost(
- - contents->GetPrimaryMainFrame(), kReferrerUserGestureLimit,
- - &referrer_chain);
- -
- - // If the referrer chain is incomplete we'll append the most recent
- - // navigations to referrer chain for diagnostic purposes. This only happens if
- - // the user is not in incognito mode and has opted into extended reporting or
- - // Scout reporting. Otherwise, |CountOfRecentNavigationsToAppend| returns 0.
- - int recent_navigations_to_collect =
- - SafeBrowsingNavigationObserverManager::CountOfRecentNavigationsToAppend(
- - profile, profile->GetPrefs(), result);
- - if (recent_navigations_to_collect > 0) {
- - navigation_observer_manager->AppendRecentNavigations(
- - recent_navigations_to_collect, &referrer_chain);
- - }
- -
- std::vector<api::safe_browsing_private::ReferrerChainEntry> referrer_entries;
- - referrer_entries.reserve(referrer_chain.size());
- - for (const auto& entry : referrer_chain) {
- - referrer_entries.emplace_back(
- - safe_browsing_util::ReferrerToReferrerChainEntry(entry));
- - }
- return RespondNow(ArgumentList(
- api::safe_browsing_private::GetReferrerChain::Results::Create(
- referrer_entries)));
- --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
- +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
- @@ -717,18 +717,6 @@ void WebstorePrivateBeginInstallWithMani
-
- void WebstorePrivateBeginInstallWithManifest3Function::
- ReportFrictionAcceptedEvent() {
- - if (!profile_) {
- - return;
- - }
- - auto* metrics_collector =
- - safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
- - profile_);
- - // `metrics_collector` can be null in incognito.
- - if (metrics_collector) {
- - metrics_collector->AddSafeBrowsingEventToPref(
- - safe_browsing::SafeBrowsingMetricsCollector::EventType::
- - EXTENSION_ALLOWLIST_INSTALL_BYPASS);
- - }
- }
-
- void WebstorePrivateBeginInstallWithManifest3Function::OnInstallPromptDone(
- @@ -1236,56 +1224,9 @@ WebstorePrivateGetReferrerChainFunction:
-
- ExtensionFunction::ResponseAction
- WebstorePrivateGetReferrerChainFunction::Run() {
- - Profile* profile = Profile::FromBrowserContext(browser_context());
- - if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(
- - profile->GetPrefs(), g_browser_process->safe_browsing_service()))
- - return RespondNow(ArgumentList(
- - api::webstore_private::GetReferrerChain::Results::Create("")));
- -
- - content::RenderFrameHost* outermost_render_frame_host =
- - render_frame_host() ? render_frame_host()->GetOutermostMainFrame()
- - : nullptr;
- -
- - if (!outermost_render_frame_host) {
- - return RespondNow(ErrorWithArguments(
- - api::webstore_private::GetReferrerChain::Results::Create(""),
- - kWebstoreUserCancelledError));
- - }
- -
- - SafeBrowsingNavigationObserverManager* navigation_observer_manager =
- - safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- - GetForBrowserContext(profile);
- -
- - safe_browsing::ReferrerChain referrer_chain;
- - SafeBrowsingNavigationObserverManager::AttributionResult result =
- - navigation_observer_manager->IdentifyReferrerChainByRenderFrameHost(
- - outermost_render_frame_host, kExtensionReferrerUserGestureLimit,
- - &referrer_chain);
- -
- - // If the referrer chain is incomplete we'll append the most recent
- - // navigations to referrer chain for diagnostic purposes. This only happens if
- - // the user is not in incognito mode and has opted into extended reporting or
- - // Scout reporting. Otherwise, |CountOfRecentNavigationsToAppend| returns 0.
- - int recent_navigations_to_collect =
- - SafeBrowsingNavigationObserverManager::CountOfRecentNavigationsToAppend(
- - profile, profile->GetPrefs(), result);
- - if (recent_navigations_to_collect > 0) {
- - navigation_observer_manager->AppendRecentNavigations(
- - recent_navigations_to_collect, &referrer_chain);
- - }
- -
- - safe_browsing::ExtensionWebStoreInstallRequest request;
- - request.mutable_referrer_chain()->Swap(&referrer_chain);
- - request.mutable_referrer_chain_options()->set_recent_navigations_to_collect(
- - recent_navigations_to_collect);
- -
- - std::string serialized_referrer_proto = request.SerializeAsString();
- - // Base64 encode the proto to avoid issues with base::Value rejecting strings
- - // which are not valid UTF8.
- - base::Base64Encode(serialized_referrer_proto, &serialized_referrer_proto);
- return RespondNow(
- ArgumentList(api::webstore_private::GetReferrerChain::Results::Create(
- - serialized_referrer_proto)));
- + "")));
- }
-
- WebstorePrivateGetExtensionStatusFunction::
- --- a/chrome/browser/extensions/blocklist_state_fetcher.cc
- +++ b/chrome/browser/extensions/blocklist_state_fetcher.cc
- @@ -38,23 +38,8 @@ BlocklistStateFetcher::~BlocklistStateFe
- void BlocklistStateFetcher::Request(const std::string& id,
- RequestCallback callback) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- - if (!safe_browsing_config_) {
- - if (g_browser_process && g_browser_process->safe_browsing_service()) {
- - SetSafeBrowsingConfig(
- - g_browser_process->safe_browsing_service()->GetV4ProtocolConfig());
- - } else {
- - base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
- - FROM_HERE, base::BindOnce(std::move(callback), BLOCKLISTED_UNKNOWN));
- - return;
- - }
- - }
- -
- - bool request_already_sent = base::Contains(callbacks_, id);
- - callbacks_.insert(std::make_pair(id, std::move(callback)));
- - if (request_already_sent)
- - return;
- -
- - SendRequest(id);
- + base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
- + FROM_HERE, base::BindOnce(std::move(callback), BLOCKLISTED_UNKNOWN));
- }
-
- void BlocklistStateFetcher::SendRequest(const std::string& id) {
- @@ -65,8 +50,7 @@ void BlocklistStateFetcher::SendRequest(
- std::string request_str;
- request.SerializeToString(&request_str);
-
- - GURL request_url = GURL(safe_browsing::GetReportUrl(
- - *safe_browsing_config_, "clientreport/crx-list-info"));
- + GURL request_url = GURL();
- net::NetworkTrafficAnnotationTag traffic_annotation =
- net::DefineNetworkTrafficAnnotation("extension_blacklist", R"(
- semantics {
- @@ -126,12 +110,6 @@ void BlocklistStateFetcher::SendRequest(
- base::Unretained(this), fetcher));
- }
-
- -void BlocklistStateFetcher::SetSafeBrowsingConfig(
- - const safe_browsing::V4ProtocolConfig& config) {
- - safe_browsing_config_ =
- - std::make_unique<safe_browsing::V4ProtocolConfig>(config);
- -}
- -
- void BlocklistStateFetcher::OnURLLoaderComplete(
- network::SimpleURLLoader* url_loader,
- std::unique_ptr<std::string> response_body) {
- --- a/chrome/browser/extensions/blocklist_state_fetcher.h
- +++ b/chrome/browser/extensions/blocklist_state_fetcher.h
- @@ -36,8 +36,6 @@ class BlocklistStateFetcher {
-
- virtual void Request(const std::string& id, RequestCallback callback);
-
- - void SetSafeBrowsingConfig(const safe_browsing::V4ProtocolConfig& config);
- -
- protected:
- void OnURLLoaderComplete(network::SimpleURLLoader* url_loader,
- std::unique_ptr<std::string> response_body);
- @@ -56,7 +54,6 @@ class BlocklistStateFetcher {
-
- void SendRequest(const std::string& id);
-
- - std::unique_ptr<safe_browsing::V4ProtocolConfig> safe_browsing_config_;
- scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
-
- // SimpleURLLoader -> (owned loader, extension id).
- --- a/chrome/browser/profiles/profile_impl.cc
- +++ b/chrome/browser/profiles/profile_impl.cc
- @@ -92,7 +92,6 @@
- #include "chrome/browser/push_messaging/push_messaging_service_factory.h"
- #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
- #include "chrome/browser/reduce_accept_language/reduce_accept_language_factory.h"
- -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
- #include "chrome/browser/sessions/exit_type_service.h"
- #include "chrome/browser/sharing/sharing_service_factory.h"
- #include "chrome/browser/signin/identity_manager_factory.h"
- @@ -646,17 +645,6 @@ void ProfileImpl::LoadPrefsForNormalStar
-
- mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate>
- pref_validation_delegate;
- - scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service(
- - g_browser_process->safe_browsing_service());
- - if (safe_browsing_service.get()) {
- - auto pref_validation_delegate_impl =
- - safe_browsing_service->CreatePreferenceValidationDelegate(this);
- - if (pref_validation_delegate_impl) {
- - mojo::MakeSelfOwnedReceiver(
- - std::move(pref_validation_delegate_impl),
- - pref_validation_delegate.InitWithNewPipeAndPassReceiver());
- - }
- - }
-
- prefs_ =
- CreatePrefService(pref_registry_, CreateExtensionPrefStore(this, false),
- --- a/chrome/browser/profiles/profiles_state.cc
- +++ b/chrome/browser/profiles/profiles_state.cc
- @@ -261,9 +261,6 @@ void RemoveBrowsingDataForProfile(const
- // The BrowsingDataRemover relies on many objects that aren't created in unit
- // tests. Previously this code would depend on content::ResourceDispatcherHost
- // but that's gone, so do a similar hack for now.
- - if (!g_browser_process->safe_browsing_service())
- - return;
- -
- Profile* profile =
- g_browser_process->profile_manager()->GetProfileByPath(profile_path);
- if (!profile)
- --- a/chrome/browser/safe_browsing/BUILD.gn
- +++ b/chrome/browser/safe_browsing/BUILD.gn
- @@ -7,6 +7,7 @@ import("//components/safe_browsing/build
- import("//extensions/buildflags/buildflags.gni")
-
- static_library("safe_browsing") {
- + if (false) {
- sources = [
- "chrome_controller_client.cc",
- "chrome_controller_client.h",
- @@ -68,6 +69,7 @@ static_library("safe_browsing") {
- "//mojo/public/cpp/system",
- "//services/preferences/public/cpp",
- ]
- + }
-
- if (safe_browsing_mode != 0) {
- # "Safe Browsing Basic" files used for safe browsing in full mode
- @@ -495,6 +497,7 @@ static_library("advanced_protection") {
- }
-
- source_set("metrics_collector") {
- + if (false) {
- sources = [
- "safe_browsing_metrics_collector_factory.cc",
- "safe_browsing_metrics_collector_factory.h",
- @@ -514,6 +517,7 @@ source_set("metrics_collector") {
- "//components/safe_browsing/core/common:safe_browsing_prefs",
- "//content/public/browser",
- ]
- + }
- }
-
- source_set("test_support") {
- --- a/chrome/browser/ssl/security_state_tab_helper.cc
- +++ b/chrome/browser/ssl/security_state_tab_helper.cc
- @@ -174,92 +174,6 @@ bool SecurityStateTabHelper::UsedPolicyI
-
- security_state::MaliciousContentStatus
- SecurityStateTabHelper::GetMaliciousContentStatus() const {
- - content::NavigationEntry* entry =
- - web_contents()->GetController().GetVisibleEntry();
- - if (!entry)
- - return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- - safe_browsing::SafeBrowsingService* sb_service =
- - g_browser_process->safe_browsing_service();
- - if (!sb_service)
- - return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- - scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager();
- - safe_browsing::SBThreatType threat_type;
- - if (sb_ui_manager->IsUrlAllowlistedOrPendingForWebContents(
- - entry->GetURL(), false, entry, web_contents(), false, &threat_type)) {
- - switch (threat_type) {
- - case safe_browsing::SB_THREAT_TYPE_UNUSED:
- - case safe_browsing::SB_THREAT_TYPE_SAFE:
- - case safe_browsing::SB_THREAT_TYPE_URL_PHISHING:
- - case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING:
- - return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING;
- - case safe_browsing::SB_THREAT_TYPE_URL_MALWARE:
- - case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE:
- - return security_state::MALICIOUS_CONTENT_STATUS_MALWARE;
- - case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED:
- - return security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE;
- - case safe_browsing::SB_THREAT_TYPE_SAVED_PASSWORD_REUSE:
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - return security_state::MALICIOUS_CONTENT_STATUS_SAVED_PASSWORD_REUSE;
- -#endif
- - case safe_browsing::SB_THREAT_TYPE_SIGNED_IN_SYNC_PASSWORD_REUSE:
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - if (safe_browsing::ChromePasswordProtectionService::
- - ShouldShowPasswordReusePageInfoBubble(
- - web_contents(), PasswordType::PRIMARY_ACCOUNT_PASSWORD)) {
- - return security_state::
- - MALICIOUS_CONTENT_STATUS_SIGNED_IN_SYNC_PASSWORD_REUSE;
- - }
- -#endif
- - [[fallthrough]];
- - case safe_browsing::SB_THREAT_TYPE_SIGNED_IN_NON_SYNC_PASSWORD_REUSE:
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - if (safe_browsing::ChromePasswordProtectionService::
- - ShouldShowPasswordReusePageInfoBubble(
- - web_contents(), PasswordType::OTHER_GAIA_PASSWORD)) {
- - return security_state::
- - MALICIOUS_CONTENT_STATUS_SIGNED_IN_NON_SYNC_PASSWORD_REUSE;
- - }
- -#endif
- - [[fallthrough]];
- - case safe_browsing::SB_THREAT_TYPE_ENTERPRISE_PASSWORD_REUSE:
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - if (safe_browsing::ChromePasswordProtectionService::
- - ShouldShowPasswordReusePageInfoBubble(
- - web_contents(), PasswordType::ENTERPRISE_PASSWORD)) {
- - return security_state::
- - MALICIOUS_CONTENT_STATUS_ENTERPRISE_PASSWORD_REUSE;
- - }
- -#endif
- - // If user has already changed password or FULL_SAFE_BROWSING isn't
- - // enabled, returns the regular social engineering content status.
- - return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING;
- - case safe_browsing::SB_THREAT_TYPE_BILLING:
- - return security_state::MALICIOUS_CONTENT_STATUS_BILLING;
- - case safe_browsing::SB_THREAT_TYPE_MANAGED_POLICY_BLOCK:
- - return security_state::MALICIOUS_CONTENT_STATUS_MANAGED_POLICY_BLOCK;
- - case safe_browsing::SB_THREAT_TYPE_MANAGED_POLICY_WARN:
- - return security_state::MALICIOUS_CONTENT_STATUS_MANAGED_POLICY_WARN;
- - case safe_browsing::
- - DEPRECATED_SB_THREAT_TYPE_URL_PASSWORD_PROTECTION_PHISHING:
- - case safe_browsing::SB_THREAT_TYPE_URL_BINARY_MALWARE:
- - case safe_browsing::SB_THREAT_TYPE_EXTENSION:
- - case safe_browsing::SB_THREAT_TYPE_BLOCKLISTED_RESOURCE:
- - case safe_browsing::SB_THREAT_TYPE_API_ABUSE:
- - case safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER:
- - case safe_browsing::SB_THREAT_TYPE_CSD_ALLOWLIST:
- - case safe_browsing::SB_THREAT_TYPE_AD_SAMPLE:
- - case safe_browsing::SB_THREAT_TYPE_BLOCKED_AD_POPUP:
- - case safe_browsing::SB_THREAT_TYPE_BLOCKED_AD_REDIRECT:
- - case safe_browsing::SB_THREAT_TYPE_SUSPICIOUS_SITE:
- - case safe_browsing::SB_THREAT_TYPE_APK_DOWNLOAD:
- - case safe_browsing::SB_THREAT_TYPE_HIGH_CONFIDENCE_ALLOWLIST:
- - // These threat types are not currently associated with
- - // interstitials, and thus resources with these threat types are
- - // not ever whitelisted or pending whitelisting.
- - NOTREACHED();
- - break;
- - }
- - }
- return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- }
-
- --- a/chrome/browser/ui/BUILD.gn
- +++ b/chrome/browser/ui/BUILD.gn
- @@ -5032,7 +5032,6 @@ static_library("ui") {
- "views/download/bubble/download_dialog_view.h",
- "views/download/bubble/download_toolbar_button_view.cc",
- "views/download/bubble/download_toolbar_button_view.h",
- - "views/download/download_danger_prompt_views.cc",
- "views/download/download_in_progress_dialog_view.cc",
- "views/download/download_in_progress_dialog_view.h",
- "views/download/download_item_view.cc",
- --- a/chrome/browser/ui/tab_helpers.cc
- +++ b/chrome/browser/ui/tab_helpers.cc
- @@ -471,22 +471,6 @@ void TabHelpers::AttachTabHelpers(WebCon
- // See https://crbug.com/910288.
- resource_coordinator::ResourceCoordinatorTabHelper::CreateForWebContents(
- web_contents);
- - safe_browsing::SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
- - web_contents, HostContentSettingsMapFactory::GetForProfile(profile),
- - safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- - GetForBrowserContext(profile),
- - profile->GetPrefs(), g_browser_process->safe_browsing_service());
- - if (base::FeatureList::IsEnabled(
- - safe_browsing::kTailoredSecurityIntegration)) {
- - safe_browsing::TailoredSecurityUrlObserver::CreateForWebContents(
- - web_contents,
- - safe_browsing::TailoredSecurityServiceFactory::GetForProfile(profile));
- - }
- - safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(
- - web_contents,
- - std::make_unique<safe_browsing::ChromeSafeBrowsingTabObserverDelegate>());
- - safe_browsing::TriggerCreator::MaybeCreateTriggersForWebContents(
- - profile, web_contents);
- SafetyTipWebContentsObserver::CreateForWebContents(web_contents);
- SearchEngineTabHelper::CreateForWebContents(web_contents);
- SecurityStateTabHelper::CreateForWebContents(web_contents);
- --- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
- +++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
- @@ -24,7 +24,6 @@
- #include "base/values.h"
- #include "chrome/browser/browser_process.h"
- #include "chrome/browser/download/bubble/download_bubble_ui_controller.h"
- -#include "chrome/browser/download/download_danger_prompt.h"
- #include "chrome/browser/download/download_history.h"
- #include "chrome/browser/download/download_item_model.h"
- #include "chrome/browser/download/download_item_warning_data.h"
- @@ -198,13 +197,6 @@ void DownloadsDOMHandler::SaveDangerousR
- }
-
- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
- - download::DownloadItem* file = GetDownloadByStringId(id);
- - if (file) {
- - DownloadItemWarningData::AddWarningActionEvent(
- - file, DownloadItemWarningData::WarningSurface::DOWNLOADS_PAGE,
- - DownloadItemWarningData::WarningAction::KEEP);
- - ShowDangerPrompt(file);
- - }
- }
-
- void DownloadsDOMHandler::DiscardDangerous(const std::string& id) {
- @@ -400,12 +392,6 @@ void DownloadsDOMHandler::RemoveDownload
- IdSet ids;
-
- for (auto* download : to_remove) {
- - if (download->IsDangerous() || download->IsInsecure()) {
- - // Don't allow users to revive dangerous downloads; just nuke 'em.
- - download->Remove();
- - continue;
- - }
- -
- DownloadItemModel item_model(download);
- if (!item_model.ShouldShowInShelf() ||
- download->GetState() == download::DownloadItem::IN_PROGRESS) {
- @@ -533,44 +519,6 @@ void DownloadsDOMHandler::FinalizeRemova
- }
- }
-
- -void DownloadsDOMHandler::ShowDangerPrompt(
- - download::DownloadItem* dangerous_item) {
- - DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create(
- - dangerous_item, GetWebUIWebContents(), false,
- - base::BindOnce(&DownloadsDOMHandler::DangerPromptDone,
- - weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()));
- - // danger_prompt will delete itself.
- - DCHECK(danger_prompt);
- -}
- -
- -void DownloadsDOMHandler::DangerPromptDone(
- - int download_id,
- - DownloadDangerPrompt::Action action) {
- - if (action != DownloadDangerPrompt::ACCEPT)
- - return;
- - download::DownloadItem* item = nullptr;
- - if (GetMainNotifierManager())
- - item = GetMainNotifierManager()->GetDownload(download_id);
- - if (!item && GetOriginalNotifierManager())
- - item = GetOriginalNotifierManager()->GetDownload(download_id);
- - if (!item || item->IsDone())
- - return;
- - CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
- -
- - // If a download is insecure, validate that first. Is most cases, insecure
- - // download warnings will occur first, but in the worst case scenario, we show
- - // a dangerous warning twice. That's better than showing an insecure download
- - // warning, then dismissing the dangerous download warning. Since insecure
- - // downloads triggering the UI are temporary and rare to begin with, this
- - // should very rarely occur.
- - if (item->IsInsecure()) {
- - item->ValidateInsecureDownload();
- - return;
- - }
- -
- - item->ValidateDangerousDownload();
- -}
- -
- bool DownloadsDOMHandler::IsDeletingHistoryAllowed() {
- content::DownloadManager* manager = GetMainNotifierManager();
- return manager &&
- --- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
- +++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
- @@ -12,7 +12,6 @@
-
- #include "base/memory/raw_ptr.h"
- #include "base/memory/weak_ptr.h"
- -#include "chrome/browser/download/download_danger_prompt.h"
- #include "chrome/browser/ui/webui/downloads/downloads.mojom-forward.h"
- #include "chrome/browser/ui/webui/downloads/downloads_list_tracker.h"
- #include "content/public/browser/web_contents_observer.h"
- @@ -97,18 +96,6 @@ class DownloadsDOMHandler : public conte
- // null-checking |original_notifier_|.
- content::DownloadManager* GetOriginalNotifierManager() const;
-
- - // Displays a native prompt asking the user for confirmation after accepting
- - // the dangerous download specified by |dangerous|. The function returns
- - // immediately, and will invoke DangerPromptAccepted() asynchronously if the
- - // user accepts the dangerous download. The native prompt will observe
- - // |dangerous| until either the dialog is dismissed or |dangerous| is no
- - // longer an in-progress dangerous download.
- - virtual void ShowDangerPrompt(download::DownloadItem* dangerous);
- -
- - // Conveys danger acceptance from the DownloadDangerPrompt to the
- - // DownloadItem.
- - void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action);
- -
- // Returns true if the records of any downloaded items are allowed (and able)
- // to be deleted.
- bool IsDeletingHistoryAllowed();
- --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
- +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
- @@ -281,67 +281,6 @@ CreateHttpsOnlyModePage(content::WebCont
- security_interstitials::https_only_mode::HttpInterstitialState{});
- }
-
- -std::unique_ptr<safe_browsing::SafeBrowsingBlockingPage>
- -CreateSafeBrowsingBlockingPage(content::WebContents* web_contents) {
- - safe_browsing::SBThreatType threat_type =
- - safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- - GURL request_url("http://example.com");
- - std::string url_param;
- - if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
- - &url_param)) {
- - if (GURL(url_param).is_valid()) {
- - request_url = GURL(url_param);
- - }
- - }
- - GURL main_frame_url(request_url);
- - // TODO(mattm): add flag to change main_frame_url or add dedicated flag to
- - // test subresource interstitials.
- - std::string type_param;
- - if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "type",
- - &type_param)) {
- - if (type_param == "malware") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- - } else if (type_param == "phishing") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_PHISHING;
- - } else if (type_param == "unwanted") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_UNWANTED;
- - } else if (type_param == "clientside_malware") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE;
- - } else if (type_param == "clientside_phishing") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING;
- - } else if (type_param == "billing") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_BILLING;
- - }
- - }
- - const content::GlobalRenderFrameHostId primary_main_frame_id =
- - web_contents->GetPrimaryMainFrame()->GetGlobalId();
- - safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource;
- - resource.url = request_url;
- - resource.is_subresource = request_url != main_frame_url;
- - resource.is_subframe = false;
- - resource.threat_type = threat_type;
- - resource.render_process_id = primary_main_frame_id.child_id;
- - resource.render_frame_id = primary_main_frame_id.frame_routing_id;
- - resource.threat_source =
- - g_browser_process->safe_browsing_service()
- - ->database_manager()
- - ->GetBrowseUrlThreatSource(
- - safe_browsing::CheckBrowseUrlType::kHashDatabase);
- -
- - // Normally safebrowsing interstitial types which block the main page load
- - // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and
- - // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a
- - // pending navigation when the SafeBrowsingBlockingPage is created. This demo
- - // creates a SafeBrowsingBlockingPage but does not actually show a real
- - // interstitial. Instead it extracts the html and displays it manually, so the
- - // parts which depend on the NavigationEntry are not hit.
- - auto* ui_manager =
- - g_browser_process->safe_browsing_service()->ui_manager().get();
- - return base::WrapUnique<safe_browsing::SafeBrowsingBlockingPage>(
- - ui_manager->blocking_page_factory()->CreateSafeBrowsingPage(
- - ui_manager, web_contents, main_frame_url, {resource}, true));
- -}
- -
- std::unique_ptr<EnterpriseBlockPage> CreateEnterpriseBlockPage(
- content::WebContents* web_contents) {
- const GURL kRequestUrl("https://enterprise-block.example.net");
- @@ -351,92 +290,6 @@ std::unique_ptr<EnterpriseBlockPage> Cre
- kRequestUrl));
- }
-
- -std::unique_ptr<EnterpriseWarnPage> CreateEnterpriseWarnPage(
- - content::WebContents* web_contents) {
- - const GURL kRequestUrl("https://enterprise-warn.example.net");
- -
- - auto* ui_manager =
- - g_browser_process->safe_browsing_service()->ui_manager().get();
- -
- - const content::GlobalRenderFrameHostId primary_main_frame_id =
- - web_contents->GetPrimaryMainFrame()->GetGlobalId();
- - safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource;
- - resource.url = kRequestUrl;
- - resource.is_subresource = false;
- - resource.is_subframe = false;
- - resource.threat_type = safe_browsing::SB_THREAT_TYPE_MANAGED_POLICY_WARN;
- - resource.render_process_id = primary_main_frame_id.child_id;
- - resource.render_frame_id = primary_main_frame_id.frame_routing_id;
- - resource.threat_source =
- - g_browser_process->safe_browsing_service()
- - ->database_manager()
- - ->GetBrowseUrlThreatSource(
- - safe_browsing::CheckBrowseUrlType::kHashDatabase);
- -
- - return std::make_unique<EnterpriseWarnPage>(
- - ui_manager, web_contents, kRequestUrl,
- - safe_browsing::SafeBrowsingBlockingPage::UnsafeResourceList({resource}),
- - std::make_unique<EnterpriseWarnControllerClient>(web_contents,
- - kRequestUrl));
- -}
- -
- -std::unique_ptr<TestSafeBrowsingBlockingPageQuiet>
- -CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {
- - safe_browsing::SBThreatType threat_type =
- - safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- - GURL request_url("http://example.com");
- - std::string url_param;
- - if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
- - &url_param)) {
- - if (GURL(url_param).is_valid())
- - request_url = GURL(url_param);
- - }
- - GURL main_frame_url(request_url);
- - std::string type_param;
- - bool is_giant_webview = false;
- - if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "type",
- - &type_param)) {
- - if (type_param == "malware") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- - } else if (type_param == "phishing") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_PHISHING;
- - } else if (type_param == "unwanted") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_UNWANTED;
- - } else if (type_param == "billing") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_BILLING;
- - } else if (type_param == "giant") {
- - threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- - is_giant_webview = true;
- - }
- - }
- - const content::GlobalRenderFrameHostId primary_main_frame_id =
- - web_contents->GetPrimaryMainFrame()->GetGlobalId();
- - safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource;
- - resource.url = request_url;
- - resource.is_subresource = request_url != main_frame_url;
- - resource.is_subframe = false;
- - resource.threat_type = threat_type;
- - resource.render_process_id = primary_main_frame_id.child_id;
- - resource.render_frame_id = primary_main_frame_id.frame_routing_id;
- - resource.threat_source =
- - g_browser_process->safe_browsing_service()
- - ->database_manager()
- - ->GetBrowseUrlThreatSource(
- - safe_browsing::CheckBrowseUrlType::kHashDatabase);
- -
- - // Normally safebrowsing interstitial types which block the main page load
- - // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and
- - // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a
- - // pending navigation when the SafeBrowsingBlockingPage is created. This demo
- - // creates a SafeBrowsingBlockingPage but does not actually show a real
- - // interstitial. Instead it extracts the html and displays it manually, so the
- - // parts which depend on the NavigationEntry are not hit.
- - return base::WrapUnique<TestSafeBrowsingBlockingPageQuiet>(
- - TestSafeBrowsingBlockingPageQuiet::CreateBlockingPage(
- - g_browser_process->safe_browsing_service()->ui_manager().get(),
- - web_contents, main_frame_url, resource, is_giant_webview));
- -}
- -
- #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
- std::unique_ptr<CaptivePortalBlockingPage> CreateCaptivePortalBlockingPage(
- content::WebContents* web_contents) {
- @@ -543,12 +396,8 @@ void InterstitialHTMLSource::StartDataRe
- interstitial_delegate = CreateMITMSoftwareBlockingPage(web_contents);
- } else if (path_without_query == "/blocked-interception") {
- interstitial_delegate = CreateBlockedInterceptionBlockingPage(web_contents);
- - } else if (path_without_query == "/safebrowsing") {
- - interstitial_delegate = CreateSafeBrowsingBlockingPage(web_contents);
- } else if (path_without_query == "/enterprise-block") {
- interstitial_delegate = CreateEnterpriseBlockPage(web_contents);
- - } else if (path_without_query == "/enterprise-warn") {
- - interstitial_delegate = CreateEnterpriseWarnPage(web_contents);
- } else if (path_without_query == "/clock") {
- interstitial_delegate = CreateBadClockBlockingPage(web_contents);
- } else if (path_without_query == "/lookalike") {
- @@ -563,16 +412,12 @@ void InterstitialHTMLSource::StartDataRe
- interstitial_delegate = CreateHttpsOnlyModePage(web_contents);
- }
-
- - if (path_without_query == "/quietsafebrowsing") {
- - std::unique_ptr<TestSafeBrowsingBlockingPageQuiet> blocking_page =
- - CreateSafeBrowsingQuietBlockingPage(web_contents);
- - html = blocking_page->GetHTML();
- - interstitial_delegate = std::move(blocking_page);
- #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
- - } else if (path_without_query == "/supervised_user") {
- + if (path_without_query == "/supervised_user") {
- html = GetSupervisedUserInterstitialHTML(path);
- + } else
- #endif
- - } else if (interstitial_delegate.get()) {
- + if (interstitial_delegate.get()) {
- html = interstitial_delegate.get()->GetHTMLContents();
- } else {
- html = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
- --- a/chrome/renderer/chrome_content_renderer_client.cc
- +++ b/chrome/renderer/chrome_content_renderer_client.cc
- @@ -100,7 +100,6 @@
- #include "components/password_manager/core/common/password_manager_features.h"
- #include "components/permissions/features.h"
- #include "components/safe_browsing/buildflags.h"
- -#include "components/safe_browsing/content/renderer/threat_dom_details.h"
- #include "components/spellcheck/spellcheck_buildflags.h"
- #include "components/subresource_filter/content/renderer/subresource_filter_agent.h"
- #include "components/subresource_filter/content/renderer/unverified_ruleset_dealer.h"
- @@ -440,12 +439,8 @@ void ChromeContentRendererClient::Render
- subresource_filter_ruleset_dealer_ =
- std::make_unique<subresource_filter::UnverifiedRulesetDealer>();
-
- - phishing_model_setter_ =
- - std::make_unique<safe_browsing::PhishingModelSetterImpl>();
- -
- thread->AddObserver(chrome_observer_.get());
- thread->AddObserver(subresource_filter_ruleset_dealer_.get());
- - thread->AddObserver(phishing_model_setter_.get());
-
- blink::WebScriptController::RegisterExtension(
- extensions_v8::LoadTimesExtension::Get());
- --- a/components/security_interstitials/content/cert_report_helper.cc
- +++ b/components/security_interstitials/content/cert_report_helper.cc
- @@ -177,7 +177,6 @@ void CertReportHelper::FinishCertCollect
- return;
- }
-
- - ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report);
- }
-
- bool CertReportHelper::ShouldShowCertificateReporterCheckbox() {
|