From 532c9c5c8b2c8ab5a32bad0b0c635292dcd4e945 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Fri, 4 Jan 2019 16:49:17 +0100 Subject: [PATCH] Update safe browsing patch for Android to fix issues found by nikolowry --- ...ing-without-safebrowsing-for-Android.patch | 510 +++++++++++++++++- 1 file changed, 509 insertions(+), 1 deletion(-) diff --git a/build/patches/Allow-building-without-safebrowsing-for-Android.patch b/build/patches/Allow-building-without-safebrowsing-for-Android.patch index 44b45fe2..bfe8125e 100644 --- a/build/patches/Allow-building-without-safebrowsing-for-Android.patch +++ b/build/patches/Allow-building-without-safebrowsing-for-Android.patch @@ -2,14 +2,27 @@ From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Tue, 18 Sep 2018 08:06:14 +0200 Subject: Allow building without safebrowsing for Android +Fix build from scratch (issue found by nikolowry) --- .../android/java/res/xml/privacy_preferences.xml | 12 ----- .../preferences/privacy/PrivacyPreferences.java | 58 ---------------------- .../chrome_browsing_data_remover_delegate.cc | 10 ---- chrome/browser/chrome_content_browser_client.cc | 14 +----- + .../file_type_policies_component_installer.cc | 2 + + .../download/chrome_download_manager_delegate.cc | 14 +++++- + .../download/chrome_download_manager_delegate.h | 6 +++ + chrome/browser/download/download_item_model.cc | 10 ++++ + chrome/browser/download/download_item_model.h | 4 ++ + chrome/browser/download/download_prefs.cc | 4 ++ + .../browser/download/download_target_determiner.cc | 18 +++++++ + .../browser/download/download_target_determiner.h | 6 +++ + chrome/browser/download/download_target_info.cc | 4 ++ + chrome/browser/download/download_target_info.h | 4 ++ + chrome/browser/download/download_ui_model.cc | 4 ++ + chrome/browser/download/download_ui_model.h | 4 ++ .../chrome_resource_dispatcher_host_delegate.cc | 4 ++ chrome/browser/net/chrome_network_delegate.cc | 35 +------------ - 6 files changed, 7 insertions(+), 126 deletions(-) + 18 files changed, 85 insertions(+), 128 deletions(-) diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml --- a/chrome/android/java/res/xml/privacy_preferences.xml @@ -180,6 +193,501 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch } base::Optional +diff --git a/chrome/browser/component_updater/file_type_policies_component_installer.cc b/chrome/browser/component_updater/file_type_policies_component_installer.cc +--- a/chrome/browser/component_updater/file_type_policies_component_installer.cc ++++ b/chrome/browser/component_updater/file_type_policies_component_installer.cc +@@ -18,7 +18,9 @@ + #include "base/path_service.h" + #include "base/task/post_task.h" + #include "base/version.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + #include "components/component_updater/component_updater_paths.h" + + using component_updater::ComponentUpdateService; +diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc +--- a/chrome/browser/download/chrome_download_manager_delegate.cc ++++ b/chrome/browser/download/chrome_download_manager_delegate.cc +@@ -38,8 +38,10 @@ + #include "chrome/browser/download/save_package_file_picker.h" + #include "chrome/browser/platform_util.h" + #include "chrome/browser/profiles/profile.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/browser/safe_browsing/download_protection/download_protection_util.h" + #include "chrome/browser/safe_browsing/safe_browsing_service.h" ++#endif + #include "chrome/browser/ui/browser.h" + #include "chrome/browser/ui/browser_finder.h" + #include "chrome/browser/ui/chrome_pages.h" +@@ -49,7 +51,9 @@ + #include "chrome/common/chrome_features.h" + #include "chrome/common/pdf_util.h" + #include "chrome/common/pref_names.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + #include "chrome/grit/generated_resources.h" + #include "components/download/database/in_progress/in_progress_cache_impl.h" + #include "components/download/public/common/download_interrupt_reasons.h" +@@ -95,8 +99,10 @@ + using content::BrowserThread; + using download::DownloadItem; + using content::DownloadManager; ++#if defined(FULL_SAFE_BROWSING) + using safe_browsing::DownloadFileType; + using safe_browsing::DownloadProtectionService; ++#endif + + namespace { + +@@ -746,19 +752,19 @@ ChromeDownloadManagerDelegate::ApplicationClientIdForFileScanning() const { + return std::string(chrome::kApplicationClientIDStringForAVScanning); + } + ++#if defined(FULL_SAFE_BROWSING) + DownloadProtectionService* + ChromeDownloadManagerDelegate::GetDownloadProtectionService() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); +-#if defined(FULL_SAFE_BROWSING) + safe_browsing::SafeBrowsingService* sb_service = + g_browser_process->safe_browsing_service(); + if (sb_service && sb_service->download_protection_service() && + profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { + return sb_service->download_protection_service(); + } +-#endif + return NULL; + } ++#endif + + void ChromeDownloadManagerDelegate::NotifyExtensions( + DownloadItem* download, +@@ -1201,13 +1207,17 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined( + DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true); + #endif + ++#if defined(FULL_SAFE_BROWSING) + DownloadItemModel(item).SetDangerLevel(target_info->danger_level); ++#endif + } ++#if defined(FULL_SAFE_BROWSING) + if (ShouldBlockFile(target_info->danger_type, item)) { + target_info->result = download::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED; + // A dangerous type would take precendence over the blocking of the file. + target_info->danger_type = download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS; + } ++#endif + + callback.Run(target_info->target_path, target_info->target_disposition, + target_info->danger_type, target_info->intermediate_path, +diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h +--- a/chrome/browser/download/chrome_download_manager_delegate.h ++++ b/chrome/browser/download/chrome_download_manager_delegate.h +@@ -22,8 +22,10 @@ + #include "chrome/browser/download/download_path_reservation_tracker.h" + #include "chrome/browser/download/download_target_determiner_delegate.h" + #include "chrome/browser/download/download_target_info.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/browser/safe_browsing/download_protection/download_protection_service.h" + #include "chrome/browser/safe_browsing/download_protection/download_protection_util.h" ++#endif + #include "components/download/public/common/download_danger_type.h" + #include "components/download/public/common/download_item.h" + #include "content/public/browser/download_manager_delegate.h" +@@ -131,8 +133,10 @@ class ChromeDownloadManagerDelegate + DownloadPrefs* download_prefs() { return download_prefs_.get(); } + + protected: ++#if defined(FULL_SAFE_BROWSING) + virtual safe_browsing::DownloadProtectionService* + GetDownloadProtectionService(); ++#endif + + // Show file picker for |download|. + virtual void ShowFilePickerForDownload( +@@ -197,9 +201,11 @@ class ChromeDownloadManagerDelegate + const content::NotificationSource& source, + const content::NotificationDetails& details) override; + ++#if defined(FULL_SAFE_BROWSING) + // Callback function after the DownloadProtectionService completes. + void CheckClientDownloadDone(uint32_t download_id, + safe_browsing::DownloadCheckResult result); ++#endif + + // Internal gateways for ShouldCompleteDownload(). + bool IsDownloadReadyForCompletion( +diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc +--- a/chrome/browser/download/download_item_model.cc ++++ b/chrome/browser/download/download_item_model.cc +@@ -22,9 +22,11 @@ + #include "chrome/browser/download/download_stats.h" + #include "chrome/browser/download/offline_item_utils.h" + #include "chrome/browser/profiles/profile.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/browser/safe_browsing/download_protection/download_feedback_service.h" + #include "chrome/common/safe_browsing/download_file_types.pb.h" + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + #include "chrome/grit/chromium_strings.h" + #include "chrome/grit/generated_resources.h" + #include "components/download/public/common/download_danger_type.h" +@@ -37,7 +39,9 @@ + + using base::TimeDelta; + using download::DownloadItem; ++#if defined(FULL_SAFE_BROWSING) + using safe_browsing::DownloadFileType; ++#endif + + namespace { + +@@ -67,9 +71,11 @@ class DownloadItemModelData : public base::SupportsUserData::Data { + // for the file type. + bool should_prefer_opening_in_browser_; + ++#if defined(FULL_SAFE_BROWSING) + // 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_; ++#endif + + // Whether the download is currently being revived. + bool is_being_revived_; +@@ -106,7 +112,9 @@ DownloadItemModelData::DownloadItemModelData() + : should_show_in_shelf_(true), + was_ui_notified_(false), + should_prefer_opening_in_browser_(false), ++#if defined(FULL_SAFE_BROWSING) + danger_level_(DownloadFileType::NOT_DANGEROUS), ++#endif + is_being_revived_(false) {} + + } // namespace +@@ -376,6 +384,7 @@ void DownloadItemModel::SetShouldPreferOpeningInBrowser(bool preference) { + data->should_prefer_opening_in_browser_ = preference; + } + ++#if defined(FULL_SAFE_BROWSING) + DownloadFileType::DangerLevel DownloadItemModel::GetDangerLevel() const { + const DownloadItemModelData* data = DownloadItemModelData::Get(download_); + return data ? data->danger_level_ : DownloadFileType::NOT_DANGEROUS; +@@ -386,6 +395,7 @@ void DownloadItemModel::SetDangerLevel( + DownloadItemModelData* data = DownloadItemModelData::GetOrCreate(download_); + data->danger_level_ = danger_level; + } ++#endif + + bool DownloadItemModel::IsBeingRevived() const { + const DownloadItemModelData* data = DownloadItemModelData::Get(download_); +diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h +--- a/chrome/browser/download/download_item_model.h ++++ b/chrome/browser/download/download_item_model.h +@@ -11,7 +11,9 @@ + #include "base/macros.h" + #include "base/strings/string16.h" + #include "chrome/browser/download/download_ui_model.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/download_file_types.pb.h" ++#endif + #include "components/download/public/common/download_item.h" + + // Implementation of DownloadUIModel that wrappers around a |DownloadItem*|. As +@@ -48,9 +50,11 @@ class DownloadItemModel : public DownloadUIModel, + void SetWasUINotified(bool should_notify) override; + bool ShouldPreferOpeningInBrowser() const override; + void SetShouldPreferOpeningInBrowser(bool preference) override; ++#if defined(FULL_SAFE_BROWSING) + safe_browsing::DownloadFileType::DangerLevel GetDangerLevel() const override; + void SetDangerLevel( + safe_browsing::DownloadFileType::DangerLevel danger_level) override; ++#endif + void OpenUsingPlatformHandler() override; + bool IsBeingRevived() const override; + void SetIsBeingRevived(bool is_being_revived) override; +diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc +--- a/chrome/browser/download/download_prefs.cc ++++ b/chrome/browser/download/download_prefs.cc +@@ -33,7 +33,9 @@ + #include "chrome/common/chrome_features.h" + #include "chrome/common/chrome_paths.h" + #include "chrome/common/pref_names.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + #include "components/download/public/common/download_item.h" + #include "components/pref_registry/pref_registry_syncable.h" + #include "components/prefs/pref_service.h" +@@ -55,7 +57,9 @@ + using content::BrowserContext; + using content::BrowserThread; + using content::DownloadManager; ++#if defined(FULL_SAFE_BROWSING) + using safe_browsing::FileTypePolicies; ++#endif + + namespace { + +diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc +--- a/chrome/browser/download/download_target_determiner.cc ++++ b/chrome/browser/download/download_target_determiner.cc +@@ -22,7 +22,9 @@ + #include "chrome/browser/history/history_service_factory.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/common/pref_names.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + #include "chrome/grit/generated_resources.h" + #include "components/download/public/common/download_interrupt_reasons.h" + #include "components/history/core/browser/history_service.h" +@@ -56,13 +58,16 @@ + + using content::BrowserThread; + using download::DownloadItem; ++#if defined(FULL_SAFE_BROWSING) + using safe_browsing::DownloadFileType; ++#endif + + namespace { + + const base::FilePath::CharType kCrdownloadSuffix[] = + FILE_PATH_LITERAL(".crdownload"); + ++#if defined(FULL_SAFE_BROWSING) + // Condenses the results from HistoryService::GetVisibleVisitCountToHost() to a + // single bool. A host is considered visited before if prior visible visits were + // found in history and the first such visit was earlier than the most recent +@@ -76,6 +81,7 @@ void VisitCountsToVisitedBefore( + found_visits && count > 0 && + (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); + } ++#endif + + #if defined(OS_WIN) + // Keeps track of whether Adobe Reader is up to date. +@@ -100,7 +106,9 @@ DownloadTargetDeterminer::DownloadTargetDeterminer( + create_target_directory_(false), + conflict_action_(conflict_action), + danger_type_(download->GetDangerType()), ++#if defined(FULL_SAFE_BROWSING) + danger_level_(DownloadFileType::NOT_DANGEROUS), ++#endif + virtual_path_(initial_virtual_path), + is_filetype_handled_safely_(false), + #if defined(OS_ANDROID) +@@ -719,6 +727,7 @@ DownloadTargetDeterminer::Result + return CONTINUE; + } + ++#if defined(FULL_SAFE_BROWSING) + // First determine the danger level assuming that the user doesn't have any + // prior visits to the referrer recoreded in history. The resulting danger + // level would be ALLOW_ON_USER_GESTURE if the level depends on the visit +@@ -755,6 +764,7 @@ DownloadTargetDeterminer::Result + // invalid, then assume the referrer has not been visited before. + if (danger_type_ == download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) + danger_type_ = download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE; ++#endif + return CONTINUE; + } + +@@ -762,11 +772,13 @@ void DownloadTargetDeterminer::CheckVisitedReferrerBeforeDone( + bool visited_referrer_before) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK_EQ(STATE_DETERMINE_INTERMEDIATE_PATH, next_state_); ++#if defined(FULL_SAFE_BROWSING) + danger_level_ = GetDangerLevel( + visited_referrer_before ? VISITED_REFERRER : NO_VISITS_TO_REFERRER); + if (danger_level_ != DownloadFileType::NOT_DANGEROUS && + danger_type_ == download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) + danger_type_ = download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE; ++#endif + DoLoop(); + } + +@@ -861,7 +873,9 @@ void DownloadTargetDeterminer::ScheduleCallbackAndDeleteSelf( + << " Intermediate:" << intermediate_path_.AsUTF8Unsafe() + << " Confirmation reason:" << static_cast(confirmation_reason_) + << " Danger type:" << danger_type_ ++#if defined(FULL_SAFE_BROWSING) + << " Danger level:" << danger_level_ ++#endif + << " Result:" << static_cast(result); + std::unique_ptr target_info(new DownloadTargetInfo); + +@@ -873,7 +887,9 @@ void DownloadTargetDeterminer::ScheduleCallbackAndDeleteSelf( + ? DownloadItem::TARGET_DISPOSITION_PROMPT + : DownloadItem::TARGET_DISPOSITION_OVERWRITE); + target_info->danger_type = danger_type_; ++#if defined(FULL_SAFE_BROWSING) + target_info->danger_level = danger_level_; ++#endif + target_info->intermediate_path = intermediate_path_; + target_info->mime_type = mime_type_; + target_info->is_filetype_handled_safely = is_filetype_handled_safely_; +@@ -959,6 +975,7 @@ bool DownloadTargetDeterminer::HasPromptedForPath() const { + DownloadItem::TARGET_DISPOSITION_PROMPT); + } + ++#if defined(FULL_SAFE_BROWSING) + DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( + PriorVisitsToReferrer visits) const { + DCHECK_CURRENTLY_ON(BrowserThread::UI); +@@ -990,6 +1007,7 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( + + return DownloadFileType::NOT_DANGEROUS; + } ++#endif + + void DownloadTargetDeterminer::OnDownloadDestroyed( + DownloadItem* download) { +diff --git a/chrome/browser/download/download_target_determiner.h b/chrome/browser/download/download_target_determiner.h +--- a/chrome/browser/download/download_target_determiner.h ++++ b/chrome/browser/download/download_target_determiner.h +@@ -17,7 +17,9 @@ + #include "chrome/browser/download/download_path_reservation_tracker.h" + #include "chrome/browser/download/download_target_determiner_delegate.h" + #include "chrome/browser/download/download_target_info.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/download_file_types.pb.h" ++#endif + #include "components/download/public/common/download_danger_type.h" + #include "components/download/public/common/download_item.h" + #include "content/public/browser/download_manager_delegate.h" +@@ -297,6 +299,7 @@ class DownloadTargetDeterminer : public download::DownloadItem::Observer { + // operation. + bool HasPromptedForPath() const; + ++#if defined(FULL_SAFE_BROWSING) + // Returns true if this download should show the "dangerous file" warning. + // Various factors are considered, such as the type of the file, whether a + // user action initiated the download, and whether the user has explicitly +@@ -306,6 +309,7 @@ class DownloadTargetDeterminer : public download::DownloadItem::Observer { + // to true if the download requires explicit user consent. + safe_browsing::DownloadFileType::DangerLevel GetDangerLevel( + PriorVisitsToReferrer visits) const; ++#endif + + // download::DownloadItem::Observer + void OnDownloadDestroyed(download::DownloadItem* download) override; +@@ -317,7 +321,9 @@ class DownloadTargetDeterminer : public download::DownloadItem::Observer { + bool create_target_directory_; + DownloadPathReservationTracker::FilenameConflictAction conflict_action_; + download::DownloadDangerType danger_type_; ++#if defined(FULL_SAFE_BROWSING) + safe_browsing::DownloadFileType::DangerLevel danger_level_; ++#endif + base::FilePath virtual_path_; + base::FilePath local_path_; + base::FilePath intermediate_path_; +diff --git a/chrome/browser/download/download_target_info.cc b/chrome/browser/download/download_target_info.cc +--- a/chrome/browser/download/download_target_info.cc ++++ b/chrome/browser/download/download_target_info.cc +@@ -4,12 +4,16 @@ + + #include "chrome/browser/download/download_target_info.h" + ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/file_type_policies.h" ++#endif + + DownloadTargetInfo::DownloadTargetInfo() + : target_disposition(download::DownloadItem::TARGET_DISPOSITION_OVERWRITE), + danger_type(download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), ++#if defined(FULL_SAFE_BROWSING) + danger_level(safe_browsing::DownloadFileType::NOT_DANGEROUS), ++#endif + is_filetype_handled_safely(false), + result(download::DOWNLOAD_INTERRUPT_REASON_NONE) {} + +diff --git a/chrome/browser/download/download_target_info.h b/chrome/browser/download/download_target_info.h +--- a/chrome/browser/download/download_target_info.h ++++ b/chrome/browser/download/download_target_info.h +@@ -8,7 +8,9 @@ + #include + + #include "base/files/file_path.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/download_file_types.pb.h" ++#endif + #include "components/download/public/common/download_danger_type.h" + #include "components/download/public/common/download_interrupt_reasons.h" + #include "components/download/public/common/download_item.h" +@@ -32,6 +34,7 @@ struct DownloadTargetInfo { + // Danger type of the download. + download::DownloadDangerType danger_type; + ++#if defined(FULL_SAFE_BROWSING) + // The danger type of the download could be set to MAYBE_DANGEROUS_CONTENT if + // the file type is handled by SafeBrowsing. However, if the SafeBrowsing + // service is unable to verify whether the file is safe or not, we are on our +@@ -57,6 +60,7 @@ struct DownloadTargetInfo { + // SafeBrowsing may flag the file as being malicious, in which case the + // malicious classification should take precedence. + safe_browsing::DownloadFileType::DangerLevel danger_level; ++#endif + + // Suggested intermediate path. The downloaded bytes should be written to this + // path until all the bytes are available and the user has accepted a +diff --git a/chrome/browser/download/download_ui_model.cc b/chrome/browser/download/download_ui_model.cc +--- a/chrome/browser/download/download_ui_model.cc ++++ b/chrome/browser/download/download_ui_model.cc +@@ -23,7 +23,9 @@ + + using base::TimeDelta; + using download::DownloadItem; ++#if defined(FULL_SAFE_BROWSING) + using safe_browsing::DownloadFileType; ++#endif + using offline_items_collection::FailState; + + namespace { +@@ -368,12 +370,14 @@ bool DownloadUIModel::ShouldPreferOpeningInBrowser() const { + + void DownloadUIModel::SetShouldPreferOpeningInBrowser(bool preference) {} + ++#if defined(FULL_SAFE_BROWSING) + DownloadFileType::DangerLevel DownloadUIModel::GetDangerLevel() const { + return DownloadFileType::NOT_DANGEROUS; + } + + void DownloadUIModel::SetDangerLevel( + DownloadFileType::DangerLevel danger_level) {} ++#endif + + void DownloadUIModel::OpenUsingPlatformHandler() {} + +diff --git a/chrome/browser/download/download_ui_model.h b/chrome/browser/download/download_ui_model.h +--- a/chrome/browser/download/download_ui_model.h ++++ b/chrome/browser/download/download_ui_model.h +@@ -14,7 +14,9 @@ + #include "base/strings/string16.h" + #include "build/build_config.h" + #include "chrome/browser/profiles/profile_manager.h" ++#if defined(FULL_SAFE_BROWSING) + #include "chrome/common/safe_browsing/download_file_types.pb.h" ++#endif + #include "components/download/public/common/download_item.h" + #include "components/offline_items_collection/core/offline_item.h" + +@@ -172,6 +174,7 @@ class DownloadUIModel { + // Change what's returned by ShouldPreferOpeningInBrowser to |preference|. + virtual void SetShouldPreferOpeningInBrowser(bool preference); + ++#if defined(FULL_SAFE_BROWSING) + // Return the danger level determined during download target determination. + // The value returned here is independent of the danger level as determined by + // the Safe Browsing. +@@ -180,6 +183,7 @@ class DownloadUIModel { + // Change what's returned by GetDangerLevel(). + virtual void SetDangerLevel( + safe_browsing::DownloadFileType::DangerLevel danger_level); ++#endif + + // Open the download using the platform handler for the download. The behavior + // of this method will be different from DownloadItem::OpenDownload() if diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc