--- ./chrome/browser/chrome_content_browser_client.cc +++ ./chrome/browser/chrome_content_browser_client.cc.new @@ -621,10 +621,6 @@ class SafeBrowsingSSLCertReporter : public SSLCertReporter { // SSLCertReporter implementation void ReportInvalidCertificateChain( const std::string& serialized_report) override { - if (safe_browsing_ui_manager_) { - safe_browsing_ui_manager_->ReportInvalidCertificateChain( - serialized_report, base::Bind(&base::DoNothing)); - } } private: @@ -1535,7 +1531,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( // Disable client-side phishing detection in the renderer if it is // disabled in the Profile preferences or the browser process. if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || - !g_browser_process->safe_browsing_detection_service()) { + true) { command_line->AppendSwitch( switches::kDisableClientSidePhishingDetection); } @@ -2077,11 +2073,9 @@ void ChromeContentBrowserClient::AllowCertificateError( if (expired_previous_decision) options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; - safe_browsing::SafeBrowsingService* safe_browsing_service = - g_browser_process->safe_browsing_service(); std::unique_ptr cert_reporter( - new SafeBrowsingSSLCertReporter(safe_browsing_service - ? safe_browsing_service->ui_manager() + new SafeBrowsingSSLCertReporter(false + ? nullptr : nullptr)); SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, request_url, options_mask, --- ./chrome/browser/profiles/profile_impl.cc +++ ./chrome/browser/profiles/profile_impl.cc.new @@ -452,12 +452,12 @@ ProfileImpl::ProfileImpl( path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); #endif - scoped_refptr safe_browsing_service( - g_browser_process->safe_browsing_service()); - if (safe_browsing_service.get()) { - pref_validation_delegate_ = - safe_browsing_service->CreatePreferenceValidationDelegate(this); - } + //scoped_refptr safe_browsing_service( + // g_browser_process->safe_browsing_service()); + //if (safe_browsing_service.get()) { + // pref_validation_delegate_ = + // safe_browsing_service->CreatePreferenceValidationDelegate(this); + //} { prefs_ = chrome_prefs::CreateProfilePrefs( --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc @@ -376,8 +376,7 @@ } // namespace ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() - : download_request_limiter_(g_browser_process->download_request_limiter()), - safe_browsing_(g_browser_process->safe_browsing_service()) + : download_request_limiter_(g_browser_process->download_request_limiter()) #if BUILDFLAG(ENABLE_EXTENSIONS) , user_script_listener_(new extensions::UserScriptListener()) #endif @@ -426,8 +425,6 @@ content::AppCacheService* appcache_service, ResourceType resource_type, ScopedVector* throttles) { - if (safe_browsing_.get()) - safe_browsing_->OnResourceRequest(request); const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); @@ -609,13 +606,13 @@ content::ResourceThrottle* first_throttle = NULL; #if defined(OS_ANDROID) first_throttle = DataReductionProxyResourceThrottle::MaybeCreate( - request, resource_context, resource_type, safe_browsing_.get()); + request, resource_context, resource_type, nullptr); #endif // defined(OS_ANDROID) #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) if (!first_throttle && io_data->safe_browsing_enabled()->GetValue()) { first_throttle = SafeBrowsingResourceThrottle::MaybeCreate( - request, resource_type, safe_browsing_.get()); + request, resource_type, nullptr); } #endif // defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc @@ -206,7 +206,7 @@ clock_state, nullptr, base::Callback()); } - +#if 0 safe_browsing::SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( content::WebContents* web_contents) { safe_browsing::SBThreatType threat_type = @@ -259,6 +259,7 @@ g_browser_process->safe_browsing_service()->ui_manager().get(), web_contents, main_frame_url, resource); } +#endif #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) CaptivePortalBlockingPage* CreateCaptivePortalBlockingPage( @@ -346,9 +347,11 @@ std::unique_ptr interstitial_delegate; if (base::StartsWith(path, "ssl", base::CompareCase::SENSITIVE)) { interstitial_delegate.reset(CreateSSLBlockingPage(web_contents)); + /* } else if (base::StartsWith(path, "safebrowsing", base::CompareCase::SENSITIVE)) { interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents)); + */ } else if (base::StartsWith(path, "clock", base::CompareCase::SENSITIVE)) { interstitial_delegate.reset(CreateBadClockBlockingPage(web_contents)); } --- ./chrome/browser/extensions/blacklist_state_fetcher.cc +++ ./chrome/browser/extensions/blacklist_state_fetcher.cc.new @@ -35,10 +35,10 @@ BlacklistStateFetcher::~BlacklistStateFetcher() { void BlacklistStateFetcher::Request(const std::string& id, const 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()->GetProtocolConfig()); + if (true) { + if (false) { + //SetSafeBrowsingConfig( + // g_browser_process->safe_browsing_service()->GetProtocolConfig()); } else { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BLACKLISTED_UNKNOWN)); @@ -51,11 +51,11 @@ void BlacklistStateFetcher::Request(const std::string& id, if (request_already_sent) return; - if (!url_request_context_getter_ && g_browser_process && - g_browser_process->safe_browsing_service()) { - url_request_context_getter_ = - g_browser_process->safe_browsing_service()->url_request_context(); - } + //if (!url_request_context_getter_ && g_browser_process && + // g_browser_process->safe_browsing_service()) { + // url_request_context_getter_ = + // g_browser_process->safe_browsing_service()->url_request_context(); + //} SendRequest(id); } @@ -79,11 +79,11 @@ void BlacklistStateFetcher::SendRequest(const std::string& id) { fetcher->Start(); } -void BlacklistStateFetcher::SetSafeBrowsingConfig( - const safe_browsing::SafeBrowsingProtocolConfig& config) { - safe_browsing_config_.reset( - new safe_browsing::SafeBrowsingProtocolConfig(config)); -} +//void BlacklistStateFetcher::SetSafeBrowsingConfig( +// const safe_browsing::SafeBrowsingProtocolConfig& config) { +// safe_browsing_config_.reset( +// new safe_browsing::SafeBrowsingProtocolConfig(config)); +//} void BlacklistStateFetcher::SetURLRequestContextForTest( net::URLRequestContextGetter* request_context) { @@ -91,6 +91,7 @@ void BlacklistStateFetcher::SetURLRequestContextForTest( } GURL BlacklistStateFetcher::RequestUrl() const { + /* std::string url = base::StringPrintf( "%s/%s?client=%s&appver=%s&pver=2.2", safe_browsing_config_->url_prefix.c_str(), @@ -103,6 +104,8 @@ GURL BlacklistStateFetcher::RequestUrl() const { net::EscapeQueryParamValue(api_key, true).c_str()); } return GURL(url); + */ + return GURL(); } void BlacklistStateFetcher::OnURLFetchComplete(const net::URLFetcher* source) { --- ./chrome/browser/extensions/blacklist_state_fetcher.h +++ ./chrome/browser/extensions/blacklist_state_fetcher.h.new @@ -33,8 +33,8 @@ class BlacklistStateFetcher : public net::URLFetcherDelegate { virtual void Request(const std::string& id, const RequestCallback& callback); - void SetSafeBrowsingConfig( - const safe_browsing::SafeBrowsingProtocolConfig& config); + //void SetSafeBrowsingConfig( + // const safe_browsing::SafeBrowsingProtocolConfig& config); void SetURLRequestContextForTest( net::URLRequestContextGetter* request_context); @@ -53,8 +53,8 @@ class BlacklistStateFetcher : public net::URLFetcherDelegate { // ID for URLFetchers for testing. int url_fetcher_id_; - std::unique_ptr - safe_browsing_config_; + //std::unique_ptr + // safe_browsing_config_; scoped_refptr url_request_context_getter_; scoped_refptr parent_request_context_for_test_; --- ./chrome/browser/browsing_data/browsing_data_remover.cc +++ ./chrome/browser/browsing_data/browsing_data_remover.cc.new @@ -642,38 +642,6 @@ void BrowsingDataRemover::RemoveImpl( storage_partition_remove_mask |= content::StoragePartition::REMOVE_DATA_MASK_COOKIES; - // Clear the safebrowsing cookies only if time period is for "all time". It - // doesn't make sense to apply the time period of deleting in the last X - // hours/days to the safebrowsing cookies since they aren't the result of - // any user action. - if (delete_begin_ == base::Time()) { - safe_browsing::SafeBrowsingService* sb_service = - g_browser_process->safe_browsing_service(); - if (sb_service) { - scoped_refptr sb_context = - sb_service->url_request_context(); - ++waiting_for_clear_cookies_count_; - if (filter_builder.IsEmptyBlacklist()) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&ClearCookiesOnIOThread, delete_begin_, delete_end_, - base::RetainedRef(std::move(sb_context)), - UIThreadTrampoline( - base::Bind(&BrowsingDataRemover::OnClearedCookies, - weak_ptr_factory_.GetWeakPtr())))); - } else { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&ClearCookiesWithPredicateOnIOThread, delete_begin_, - delete_end_, filter_builder.BuildCookieFilter(), - base::RetainedRef(std::move(sb_context)), - UIThreadTrampoline( - base::Bind(&BrowsingDataRemover::OnClearedCookies, - weak_ptr_factory_.GetWeakPtr())))); - } - } - } - MediaDeviceIDSalt::Reset(profile_->GetPrefs()); } --- ./chrome/browser/download/chrome_download_manager_delegate.cc +++ ./chrome/browser/download/chrome_download_manager_delegate.cc.new @@ -208,13 +208,6 @@ ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 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); - } } void ChromeDownloadManagerDelegate::Shutdown() { @@ -450,16 +443,6 @@ void ChromeDownloadManagerDelegate::ChooseSavePath( 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( --- ./chrome/browser/browser_process_impl.cc +++ ./chrome/browser/browser_process_impl.cc.new @@ -67,7 +67,6 @@ #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/print_preview_dialog_controller.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/status_icons/status_tray.h" #include "chrome/browser/ui/browser_dialogs.h" @@ -204,7 +203,6 @@ BrowserProcessImpl::BrowserProcessImpl( created_icon_manager_(false), created_notification_ui_manager_(false), created_notification_bridge_(false), - created_safe_browsing_service_(false), created_subresource_filter_ruleset_service_(false), shutting_down_(false), tearing_down_(false), @@ -288,8 +286,6 @@ void BrowserProcessImpl::StartTearDown() { // that URLFetcher operation before going away.) metrics_services_manager_.reset(); intranet_redirect_detector_.reset(); - if (safe_browsing_service_.get()) - safe_browsing_service()->ShutDown(); network_time_tracker_.reset(); #if defined(ENABLE_PLUGIN_INSTALLATION) plugins_resource_service_.reset(); @@ -865,22 +861,6 @@ StatusTray* BrowserProcessImpl::status_tray() { return status_tray_.get(); } -safe_browsing::SafeBrowsingService* -BrowserProcessImpl::safe_browsing_service() { - DCHECK(CalledOnValidThread()); - if (!created_safe_browsing_service_) - CreateSafeBrowsingService(); - return safe_browsing_service_.get(); -} - -safe_browsing::ClientSideDetectionService* - BrowserProcessImpl::safe_browsing_detection_service() { - DCHECK(CalledOnValidThread()); - if (safe_browsing_service()) - return safe_browsing_service()->safe_browsing_detection_service(); - return NULL; -} - subresource_filter::RulesetService* BrowserProcessImpl::subresource_filter_ruleset_service() { DCHECK(CalledOnValidThread()); @@ -1176,16 +1156,6 @@ void BrowserProcessImpl::CreateBackgroundPrintingManager() { #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; - safe_browsing_service_ = - safe_browsing::SafeBrowsingService::CreateSafeBrowsingService(); - safe_browsing_service_->Initialize(); -} - void BrowserProcessImpl::CreateSubresourceFilterRulesetService() { DCHECK(!subresource_filter_ruleset_service_); created_subresource_filter_ruleset_service_ = true; --- ./chrome/browser/browser_process_impl.h +++ ./chrome/browser/browser_process_impl.h.new @@ -126,9 +126,6 @@ class BrowserProcessImpl : public BrowserProcess, void set_background_mode_manager_for_test( std::unique_ptr manager) override; StatusTray* status_tray() override; - safe_browsing::SafeBrowsingService* safe_browsing_service() override; - safe_browsing::ClientSideDetectionService* safe_browsing_detection_service() - override; subresource_filter::RulesetService* subresource_filter_ruleset_service() override; @@ -253,9 +250,6 @@ class BrowserProcessImpl : public BrowserProcess, std::unique_ptr background_mode_manager_; #endif - bool created_safe_browsing_service_; - scoped_refptr safe_browsing_service_; - bool created_subresource_filter_ruleset_service_; std::unique_ptr subresource_filter_ruleset_service_; --- ./chrome/browser/metrics/chrome_metrics_services_manager_client.cc +++ ./chrome/browser/metrics/chrome_metrics_services_manager_client.cc @@ -72,21 +72,7 @@ ChromeMetricsServicesManagerClient::GetURLRequestContext() { bool ChromeMetricsServicesManagerClient::IsSafeBrowsingEnabled( const base::Closure& on_update_callback) { - // Start listening for updates to SB service state. This is done here instead - // of in the constructor to avoid errors from trying to instantiate SB - // service before the IO thread exists. - safe_browsing::SafeBrowsingService* sb_service = - g_browser_process->safe_browsing_service(); - if (!sb_state_subscription_ && sb_service) { - // It is safe to pass the callback received from the - // MetricsServicesManager here since the MetricsServicesManager owns - // this object, which owns the sb_state_subscription_, which owns the - // pointer to the MetricsServicesManager. - sb_state_subscription_ = - sb_service->RegisterStateCallback(on_update_callback); - } - - return sb_service && sb_service->enabled_by_prefs(); + return false; } bool ChromeMetricsServicesManagerClient::IsMetricsReportingEnabled() { --- ./chrome/browser/browser_process.h +++ ./chrome/browser/browser_process.h.new @@ -42,10 +42,6 @@ class WatchDogThread; class WebRtcLogUploader; #endif -namespace safe_browsing { -class SafeBrowsingService; -} - namespace subresource_filter { class RulesetService; } @@ -111,10 +107,6 @@ namespace rappor { class RapporService; } -namespace safe_browsing { -class ClientSideDetectionService; -} - // NOT THREAD SAFE, call only from the main thread. // These functions shouldn't return NULL unless otherwise noted. class BrowserProcess { @@ -218,14 +210,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 an object which handles communication with the SafeBrowsing - // client-side detection servers. - virtual safe_browsing::ClientSideDetectionService* - safe_browsing_detection_service() = 0; - // Returns the service providing versioned storage for rules used by the Safe // Browsing subresource filter. virtual subresource_filter::RulesetService* --- ./chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h +++ ./chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h.new @@ -12,7 +12,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/download/download_danger_prompt.h" #include "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_ui_message_handler.h" @@ -104,9 +103,6 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver, // dangerous ones are immediately removed. Protected for testing. void RemoveDownloads(const DownloadVector& to_remove); - // Helper function to handle save download event. - void SaveDownload(content::DownloadItem* download); - private: using IdSet = std::set; @@ -118,19 +114,6 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver, // 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(content::DownloadItem* dangerous); - - // Conveys danger acceptance from the DownloadDangerPrompt to the - // DownloadItem. - virtual 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(); --- ./chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc +++ ./chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc.new @@ -19,7 +19,6 @@ #include "base/threading/thread.h" #include "base/values.h" #include "chrome/browser/browser_process.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_prefs.h" @@ -193,34 +192,6 @@ void MdDownloadsDOMHandler::HandleDrag(const base::ListValue* args) { void MdDownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); - content::DownloadItem* file = GetDownloadByValue(args); - SaveDownload(file); -} - -void MdDownloadsDOMHandler::SaveDownload( - content::DownloadItem* download) { - if (!download) - return; - // If danger type is NOT DANGEROUS_FILE, chrome shows users a download danger - // prompt. - if (download->GetDangerType() != - content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE) { - ShowDangerPrompt(download); - } else { - // If danger type is DANGEROUS_FILE, chrome proceeds to keep this download - // without showing download danger prompt. - if (profile_) { - PrefService* prefs = profile_->GetPrefs(); - if (!profile_->IsOffTheRecord() && - prefs->GetBoolean(prefs::kSafeBrowsingEnabled)) { - DownloadDangerPrompt::SendSafeBrowsingDownloadReport( - safe_browsing::ClientSafeBrowsingReportRequest:: - DANGEROUS_DOWNLOAD_RECOVERY, - true, *download); - } - } - DangerPromptDone(download->GetId(), DownloadDangerPrompt::ACCEPT); - } } void MdDownloadsDOMHandler::HandleDiscardDangerous( @@ -322,12 +293,6 @@ void MdDownloadsDOMHandler::RemoveDownloads(const DownloadVector& to_remove) { IdSet ids; for (auto* download : to_remove) { - if (download->IsDangerous()) { - // Don't allow users to revive dangerous downloads; just nuke 'em. - download->Remove(); - continue; - } - DownloadItemModel item_model(download); if (!item_model.ShouldShowInShelf() || download->GetState() == content::DownloadItem::IN_PROGRESS) { @@ -380,33 +345,6 @@ void MdDownloadsDOMHandler::FinalizeRemovals() { } } -void MdDownloadsDOMHandler::ShowDangerPrompt( - content::DownloadItem* dangerous_item) { - DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create( - dangerous_item, - GetWebUIWebContents(), - false, - base::Bind(&MdDownloadsDOMHandler::DangerPromptDone, - weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId())); - // danger_prompt will delete itself. - DCHECK(danger_prompt); -} - -void MdDownloadsDOMHandler::DangerPromptDone( - int download_id, DownloadDangerPrompt::Action action) { - if (action != DownloadDangerPrompt::ACCEPT) - return; - content::DownloadItem* item = NULL; - 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); - item->ValidateDangerousDownload(); -} - bool MdDownloadsDOMHandler::IsDeletingHistoryAllowed() { content::DownloadManager* manager = GetMainNotifierManager(); return manager && --- ./chrome/browser/extensions/api/downloads/downloads_api.cc +++ ./chrome/browser/extensions/api/downloads/downloads_api.cc.new @@ -35,7 +35,6 @@ #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/download/download_danger_prompt.h" #include "chrome/browser/download/download_file_icon_extractor.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/download/download_query.h" @@ -1248,9 +1247,6 @@ DownloadsAcceptDangerFunction::DownloadsAcceptDangerFunction() {} DownloadsAcceptDangerFunction::~DownloadsAcceptDangerFunction() {} -DownloadsAcceptDangerFunction::OnPromptCreatedCallback* - DownloadsAcceptDangerFunction::on_prompt_created_ = NULL; - bool DownloadsAcceptDangerFunction::RunAsync() { std::unique_ptr params( downloads::AcceptDanger::Params::Create(*args_)); @@ -1285,40 +1281,7 @@ void DownloadsAcceptDangerFunction::PromptOrWait(int download_id, int retries) { 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::Bind(&DownloadsAcceptDangerFunction::DangerPromptCallback, - this, download_id)); - // DownloadDangerPrompt deletes itself - if (on_prompt_created_ && !on_prompt_created_->is_null()) - 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(), download_id); - if (InvalidId(download_item, &error_) || - Fault(download_item->GetState() != DownloadItem::IN_PROGRESS, - errors::kNotInProgress, &error_)) - return; - switch (action) { - case DownloadDangerPrompt::ACCEPT: - download_item->ValidateDangerousDownload(); - break; - case DownloadDangerPrompt::CANCEL: - download_item->Remove(); - break; - case DownloadDangerPrompt::DISMISS: - break; - } - SendResponse(error_.empty()); + download_item->ValidateDangerousDownload(); } DownloadsShowFunction::DownloadsShowFunction() {} --- ./chrome/browser/extensions/api/downloads/downloads_api.h +++ ./chrome/browser/extensions/api/downloads/downloads_api.h.new @@ -13,7 +13,6 @@ #include "base/scoped_observer.h" #include "base/time/time.h" #include "chrome/browser/download/all_download_item_notifier.h" -#include "chrome/browser/download/download_danger_prompt.h" #include "chrome/browser/download/download_path_reservation_tracker.h" #include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/common/extensions/api/downloads.h" @@ -193,25 +192,16 @@ class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction { class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction { public: - typedef base::Callback OnPromptCreatedCallback; - static void OnPromptCreatedForTesting( - OnPromptCreatedCallback* callback) { - on_prompt_created_ = callback; - } - DECLARE_EXTENSION_FUNCTION("downloads.acceptDanger", DOWNLOADS_ACCEPTDANGER) DownloadsAcceptDangerFunction(); bool RunAsync() override; protected: ~DownloadsAcceptDangerFunction() override; - void DangerPromptCallback(int download_id, - DownloadDangerPrompt::Action action); private: void PromptOrWait(int download_id, int retries); - static OnPromptCreatedCallback* on_prompt_created_; DISALLOW_COPY_AND_ASSIGN(DownloadsAcceptDangerFunction); }; --- ./chrome/browser/download/download_prefs.cc +++ ./chrome/browser/download/download_prefs.cc.new @@ -49,7 +49,6 @@ using content::BrowserContext; using content::BrowserThread; using content::DownloadManager; -using safe_browsing::FileTypePolicies; namespace { @@ -184,13 +183,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { 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_.insert(extension); + auto_open_.insert(extension); } } @@ -315,9 +308,6 @@ bool DownloadPrefs::IsAutoOpenEnabledBasedOnExtension( bool DownloadPrefs::EnableAutoOpenBasedOnExtension( 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); --- ./chrome/browser/component_updater/file_type_policies_component_installer.cc +++ ./chrome/browser/component_updater/file_type_policies_component_installer.cc.new @@ -35,20 +35,6 @@ const uint8_t kPublicKeySHA256[32] = { 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 --- ./chrome/browser/download/download_target_determiner.cc +++ ./chrome/browser/download/download_target_determiner.cc.new @@ -892,29 +892,7 @@ download_->HasUserGesture()) return DownloadFileType::NOT_DANGEROUS; - DownloadFileType::DangerLevel danger_level = - safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel( - virtual_path_.BaseName()); - - // 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; } void DownloadTargetDeterminer::OnDownloadDestroyed( --- ./chrome/browser/permissions/permission_uma_util.cc +++ ./chrome/browser/permissions/permission_uma_util.cc.new @@ -608,8 +608,6 @@ requesting_origin, permission, profile), PermissionDecisionAutoBlocker::GetIgnoreCount( requesting_origin, permission, profile)); - g_browser_process->safe_browsing_service() - ->ui_manager()->ReportPermissionAction(report_info); } bool secure_origin = content::IsOriginSecure(requesting_origin); --- ./chrome/browser/download/download_commands.cc +++ ./chrome/browser/download/download_commands.cc.new @@ -185,9 +185,6 @@ // filename. Don't base an "Always open" decision based on it. Also // exclude extensions. return download_item_->CanOpenDownload() && - safe_browsing::FileTypePolicies::GetInstance() - ->IsAllowedToOpenAutomatically( - download_item_->GetTargetFilePath()) && !download_crx_util::IsExtensionDownload(*download_item_); case CANCEL: return !download_item_->IsDone(); --- ./chrome/browser/BUILD.gn +++ ./chrome/browser/BUILD.gn.new @@ -2590,8 +2590,6 @@ split_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_permission_request.cc", --- ./chrome/browser/ui/BUILD.gn +++ ./chrome/browser/ui/BUILD.gn.new @@ -1618,7 +1618,6 @@ split_static_library("ui") { "views/constrained_web_dialog_delegate_views.cc", "views/create_application_shortcut_view.cc", "views/create_application_shortcut_view.h", - "views/download/download_danger_prompt_views.cc", "views/download/download_feedback_dialog_view.cc", "views/download/download_feedback_dialog_view.h", "views/download/download_in_progress_dialog_view.cc", @@ -2557,7 +2556,6 @@ split_static_library("ui") { "cocoa/dev_tools_controller.mm", "cocoa/download/background_theme.h", "cocoa/download/background_theme.mm", - "cocoa/download/download_danger_prompt_impl.cc", "cocoa/download/download_item_button.h", "cocoa/download/download_item_button.mm", "cocoa/download/download_item_cell.h", --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc @@ -156,40 +156,6 @@ 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 sb_ui_manager = sb_service->ui_manager(); - safe_browsing::SBThreatType threat_type; - if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents( - 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: - break; - case safe_browsing::SB_THREAT_TYPE_URL_PHISHING: - case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: - return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING; - break; - case safe_browsing::SB_THREAT_TYPE_URL_MALWARE: - case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: - return security_state::MALICIOUS_CONTENT_STATUS_MALWARE; - break; - case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED: - return security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; - break; - case safe_browsing::SB_THREAT_TYPE_BINARY_MALWARE_URL: - case safe_browsing::SB_THREAT_TYPE_EXTENSION: - case safe_browsing::SB_THREAT_TYPE_BLACKLISTED_RESOURCE: - case safe_browsing::SB_THREAT_TYPE_API_ABUSE: - // 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; }