2724 lines
133 KiB
Diff
2724 lines
133 KiB
Diff
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||
Date: Tue, 16 Oct 2018 05:22:59 +0200
|
||
Subject: Disable safe browsing
|
||
|
||
Originally based on ungoogled-chromium patch
|
||
Contains Android-specific fixes to remove Safe Browsing
|
||
Disable CrowdDeny feature
|
||
---
|
||
.../res/xml/google_services_preferences.xml | 20 ------
|
||
.../java/res/xml/privacy_preferences.xml | 11 ---
|
||
.../res/xml/sync_and_services_preferences.xml | 20 ------
|
||
.../EnhancedProtectionPromoController.java | 8 ---
|
||
.../EnhancedProtectionPromoUtils.java | 3 +-
|
||
.../privacy/settings/PrivacySettings.java | 50 +------------
|
||
.../SafeBrowsingSettingsLauncher.java | 9 ---
|
||
.../sync/settings/GoogleServicesSettings.java | 10 +--
|
||
.../settings/SyncAndServicesSettings.java | 15 +---
|
||
.../android/chrome_main_delegate_android.cc | 1 +
|
||
chrome/browser/BUILD.gn | 23 ------
|
||
chrome/browser/about_flags.cc | 2 +-
|
||
.../tab_web_contents_delegate_android.cc | 4 ++
|
||
chrome/browser/browser_process.h | 7 --
|
||
chrome/browser/browser_process_impl.cc | 29 --------
|
||
chrome/browser/browser_process_impl.h | 4 --
|
||
.../chrome_browsing_data_remover_delegate.cc | 2 +
|
||
.../browser/chrome_content_browser_client.cc | 28 ++++----
|
||
...ontent_browser_client_receiver_bindings.cc | 2 +
|
||
.../file_type_policies_component_installer.cc | 16 +----
|
||
.../chrome_download_manager_delegate.cc | 35 ++++-----
|
||
.../chrome_download_manager_delegate.h | 8 ++-
|
||
.../browser/download/download_item_model.cc | 15 +++-
|
||
chrome/browser/download/download_item_model.h | 4 ++
|
||
chrome/browser/download/download_prefs.cc | 17 ++---
|
||
.../download/download_target_determiner.cc | 44 ++++++------
|
||
.../download/download_target_determiner.h | 6 ++
|
||
.../browser/download/download_target_info.cc | 4 ++
|
||
.../browser/download/download_target_info.h | 4 ++
|
||
chrome/browser/download/download_ui_model.cc | 4 ++
|
||
chrome/browser/download/download_ui_model.h | 4 ++
|
||
.../extensions/api/downloads/downloads_api.cc | 42 +----------
|
||
.../extensions/api/downloads/downloads_api.h | 9 ---
|
||
.../webstore_private/webstore_private_api.cc | 44 +-----------
|
||
.../lookalike_url_controller_client.cc | 4 --
|
||
.../metrics/chrome_metrics_service_client.cc | 3 -
|
||
...e_native_file_system_permission_context.cc | 5 +-
|
||
...me_native_file_system_permission_context.h | 3 +
|
||
...ial_comparison_cert_verifier_controller.cc | 3 -
|
||
.../chrome_password_manager_client.cc | 2 +
|
||
...ve_origin_permission_revocation_request.cc | 2 +
|
||
.../permissions/chrome_permissions_client.cc | 15 ----
|
||
.../permissions/chrome_permissions_client.h | 3 -
|
||
...hrome_browser_main_extra_parts_profiles.cc | 2 -
|
||
chrome/browser/profiles/profile_impl.cc | 4 +-
|
||
chrome/browser/safe_browsing/BUILD.gn | 3 +-
|
||
chrome/browser/safe_browsing/android/BUILD.gn | 3 -
|
||
.../safe_browsing/SafeBrowsingBridge.java | 71 -------------------
|
||
.../password_reuse_controller_android.h | 6 ++
|
||
.../android/safe_browsing_bridge.cc | 51 -------------
|
||
.../download_protection_service.cc | 7 --
|
||
.../download_protection_service.h | 5 --
|
||
.../url_lookup_service_factory.cc | 4 ++
|
||
.../safety_check/SafetyCheckMediator.java | 25 -------
|
||
.../ssl/sct_reporting_service_factory.cc | 11 +--
|
||
.../browser/ssl/security_state_tab_helper.cc | 10 +--
|
||
.../chrome_subresource_filter_client.cc | 4 ++
|
||
chrome/browser/ui/BUILD.gn | 1 -
|
||
.../strings/android_chrome_strings.grd | 21 ------
|
||
chrome/browser/ui/tab_helpers.cc | 10 ---
|
||
.../ui/webui/interstitials/interstitial_ui.cc | 13 ++--
|
||
chrome/common/safe_browsing/BUILD.gn | 5 +-
|
||
.../chrome_content_renderer_client.cc | 2 +
|
||
.../permissions/permission_request_manager.cc | 28 ++++++--
|
||
components/safe_browsing/core/features.cc | 2 +-
|
||
.../safe_browsing/core/file_type_policies.cc | 3 +-
|
||
.../content/captive_portal_blocking_page.cc | 7 --
|
||
.../content/cert_report_helper.cc | 2 -
|
||
.../unified_consent_service.cc | 2 +-
|
||
.../native_file_system_file_writer_impl.cc | 50 +------------
|
||
.../native_file_system_file_writer_impl.h | 14 +---
|
||
.../native_file_system_permission_context.h | 6 --
|
||
72 files changed, 189 insertions(+), 727 deletions(-)
|
||
|
||
diff --git a/chrome/android/java/res/xml/google_services_preferences.xml b/chrome/android/java/res/xml/google_services_preferences.xml
|
||
--- a/chrome/android/java/res/xml/google_services_preferences.xml
|
||
+++ b/chrome/android/java/res/xml/google_services_preferences.xml
|
||
@@ -24,30 +24,10 @@
|
||
android:title="@string/autocomplete_searches_and_urls_title"
|
||
android:summary="@string/autocomplete_searches_and_urls_summary"
|
||
android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="navigation_error"
|
||
- android:title="@string/navigation_error_suggestions_title"
|
||
- android:summary="@string/navigation_error_suggestions_summary"
|
||
- android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="safe_browsing"
|
||
- android:title="@string/safe_browsing_title"
|
||
- android:summary="@string/safe_browsing_summary"
|
||
- android:persistent="false"/>
|
||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
android:key="password_leak_detection"
|
||
android:title="@string/passwords_leak_detection_switch_title"
|
||
android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="safe_browsing_scout_reporting"
|
||
- android:title="@string/safe_browsing_scout_reporting_title"
|
||
- android:summary="@string/safe_browsing_scout_reporting_summary"
|
||
- android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="usage_and_crash_reports"
|
||
- android:title="@string/usage_and_crash_reports_title"
|
||
- android:summary="@string/usage_and_crash_reports_summary"
|
||
- android:persistent="false"/>
|
||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
android:key="url_keyed_anonymized_data"
|
||
android:title="@string/url_keyed_anonymized_data_title"
|
||
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
|
||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||
@@ -18,11 +18,6 @@
|
||
android:summary="@string/preload_pages_summary"
|
||
android:persistent="false"
|
||
android:order="1"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||
- android:key="usage_stats_reporting"
|
||
- android:title="@string/usage_stats_setting_title"
|
||
- android:persistent="false"
|
||
- android:order="2"/>
|
||
<Preference
|
||
android:fragment="org.chromium.chrome.browser.privacy.settings.DoNotTrackSettings"
|
||
android:key="do_not_track"
|
||
@@ -39,12 +34,6 @@
|
||
android:summary="@string/clear_browsing_data_summary"
|
||
android:fragment="org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTabsFragment"
|
||
android:order="5"/>
|
||
- <Preference
|
||
- android:key="safe_browsing"
|
||
- android:title="@string/prefs_safe_browsing_title"
|
||
- android:summary="@string/prefs_safe_browsing_summary"
|
||
- android:fragment="org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment"
|
||
- android:order="6"/>
|
||
<org.chromium.components.browser_ui.settings.TextMessagePreference
|
||
android:key="sync_and_services_link"
|
||
android:summary="@string/privacy_sync_and_services_link_legacy"
|
||
diff --git a/chrome/android/java/res/xml/sync_and_services_preferences.xml b/chrome/android/java/res/xml/sync_and_services_preferences.xml
|
||
--- a/chrome/android/java/res/xml/sync_and_services_preferences.xml
|
||
+++ b/chrome/android/java/res/xml/sync_and_services_preferences.xml
|
||
@@ -56,30 +56,10 @@
|
||
android:title="@string/autocomplete_searches_and_urls_title"
|
||
android:summary="@string/autocomplete_searches_and_urls_summary"
|
||
android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="navigation_error"
|
||
- android:title="@string/navigation_error_suggestions_title"
|
||
- android:summary="@string/navigation_error_suggestions_summary"
|
||
- android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="safe_browsing"
|
||
- android:title="@string/safe_browsing_title"
|
||
- android:summary="@string/safe_browsing_summary"
|
||
- android:persistent="false"/>
|
||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
android:key="password_leak_detection"
|
||
android:title="@string/passwords_leak_detection_switch_title"
|
||
android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="safe_browsing_scout_reporting"
|
||
- android:title="@string/safe_browsing_scout_reporting_title"
|
||
- android:summary="@string/safe_browsing_scout_reporting_summary"
|
||
- android:persistent="false"/>
|
||
- <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
- android:key="usage_and_crash_reports"
|
||
- android:title="@string/usage_and_crash_reports_title"
|
||
- android:summary="@string/usage_and_crash_reports_summary"
|
||
- android:persistent="false"/>
|
||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||
android:key="url_keyed_anonymized_data"
|
||
android:title="@string/url_keyed_anonymized_data_title"
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoController.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoController.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoController.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoController.java
|
||
@@ -16,8 +16,6 @@ import androidx.appcompat.content.res.AppCompatResources;
|
||
import org.chromium.chrome.R;
|
||
import org.chromium.chrome.browser.ntp.cards.promo.enhanced_protection.EnhancedProtectionPromoUtils.EnhancedProtectionPromoAction;
|
||
import org.chromium.chrome.browser.profiles.Profile;
|
||
-import org.chromium.chrome.browser.safe_browsing.metrics.SettingsAccessPoint;
|
||
-import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment;
|
||
import org.chromium.chrome.browser.settings.SettingsLauncher;
|
||
import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
|
||
import org.chromium.components.browser_ui.widget.promo.PromoCardCoordinator;
|
||
@@ -171,12 +169,6 @@ public class EnhancedProtectionPromoController {
|
||
}
|
||
|
||
private void onPrimaryButtonClicked() {
|
||
- EnhancedProtectionPromoUtils.recordEnhancedProtectionPromoEvent(
|
||
- EnhancedProtectionPromoAction.ACCEPTED);
|
||
- SettingsLauncher launcher = new SettingsLauncherImpl();
|
||
- launcher.launchSettingsActivity(mContext, SafeBrowsingSettingsFragment.class,
|
||
- SafeBrowsingSettingsFragment.createArguments(
|
||
- SettingsAccessPoint.SURFACE_EXPLORER_PROMO_SLINGER));
|
||
}
|
||
|
||
private void onPromoSeen() {
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoUtils.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoUtils.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/enhanced_protection/EnhancedProtectionPromoUtils.java
|
||
@@ -65,8 +65,7 @@ final class EnhancedProtectionPromoUtils {
|
||
// TODO(bdea): If the user has pressed "Continue" and not selected Enhanced Protection,
|
||
// should we still show the promo.
|
||
return (profile != null) && !UserPrefs.get(profile).getBoolean(Pref.SAFE_BROWSING_ENHANCED)
|
||
- && !isPromoDismissedInSharedPreference() && (timesSeen <= maxImpressions)
|
||
- && !SafeBrowsingBridge.isSafeBrowsingManaged();
|
||
+ && !isPromoDismissedInSharedPreference() && (timesSeen <= maxImpressions);
|
||
}
|
||
|
||
static boolean isPromoDismissedInSharedPreference() {
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
|
||
@@ -30,7 +30,6 @@ import org.chromium.chrome.browser.signin.IdentityServicesProvider;
|
||
import org.chromium.chrome.browser.sync.settings.GoogleServicesSettings;
|
||
import org.chromium.chrome.browser.sync.settings.ManageSyncSettings;
|
||
import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings;
|
||
-import org.chromium.chrome.browser.usage_stats.UsageStatsConsentDialog;
|
||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||
import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate;
|
||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||
@@ -48,14 +47,13 @@ public class PrivacySettings
|
||
private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment";
|
||
private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
|
||
private static final String PREF_SECURE_DNS = "secure_dns";
|
||
- private static final String PREF_USAGE_STATS = "usage_stats_reporting";
|
||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||
- private static final String PREF_SAFE_BROWSING = "safe_browsing";
|
||
private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link";
|
||
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||
private static final String[] NEW_PRIVACY_PREFERENCE_ORDER = {PREF_CLEAR_BROWSING_DATA,
|
||
- PREF_SAFE_BROWSING, PREF_CAN_MAKE_PAYMENT, PREF_NETWORK_PREDICTIONS, PREF_USAGE_STATS,
|
||
- PREF_SECURE_DNS, PREF_DO_NOT_TRACK, PREF_SYNC_AND_SERVICES_LINK};
|
||
+ PREF_CAN_MAKE_PAYMENT, PREF_NETWORK_PREDICTIONS,
|
||
+ PREF_SECURE_DNS, PREF_DO_NOT_TRACK, PREF_SYNC_AND_SERVICES_LINK
|
||
+ };
|
||
|
||
private ManagedPreferenceDelegate mManagedPreferenceDelegate;
|
||
|
||
@@ -76,23 +74,6 @@ public class PrivacySettings
|
||
}
|
||
}
|
||
|
||
- // If the flag for adding a "Safe Browsing" section UI is enabled, a "Safe Browsing" section
|
||
- // will be added under this section and this section will be renamed to "Privacy and
|
||
- // security". See (go/esb-clank-dd) for more context.
|
||
- if (ChromeFeatureList.isEnabled(ChromeFeatureList.SAFE_BROWSING_SECTION_UI)) {
|
||
- getActivity().setTitle(R.string.prefs_privacy_security);
|
||
- Preference safeBrowsingPreference = findPreference(PREF_SAFE_BROWSING);
|
||
- safeBrowsingPreference.setSummary(
|
||
- SafeBrowsingSettingsFragment.getSafeBrowsingSummaryString(getContext()));
|
||
- safeBrowsingPreference.setOnPreferenceClickListener((preference) -> {
|
||
- preference.getExtras().putInt(SafeBrowsingSettingsFragment.ACCESS_POINT,
|
||
- SettingsAccessPoint.PARENT_SETTINGS);
|
||
- return false;
|
||
- });
|
||
- } else {
|
||
- getActivity().setTitle(R.string.prefs_privacy);
|
||
- getPreferenceScreen().removePreference(findPreference(PREF_SAFE_BROWSING));
|
||
- }
|
||
setHasOptionsMenu(true);
|
||
|
||
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
|
||
@@ -194,31 +175,6 @@ public class PrivacySettings
|
||
if (secureDnsPref != null && secureDnsPref.isVisible()) {
|
||
secureDnsPref.setSummary(SecureDnsSettings.getSummary(getContext()));
|
||
}
|
||
-
|
||
- Preference safeBrowsingPreference = findPreference(PREF_SAFE_BROWSING);
|
||
- if (safeBrowsingPreference != null && safeBrowsingPreference.isVisible()) {
|
||
- safeBrowsingPreference.setSummary(
|
||
- SafeBrowsingSettingsFragment.getSafeBrowsingSummaryString(getContext()));
|
||
- }
|
||
-
|
||
- Preference usageStatsPref = findPreference(PREF_USAGE_STATS);
|
||
- if (usageStatsPref != null) {
|
||
- if (BuildInfo.isAtLeastQ() && prefService.getBoolean(Pref.USAGE_STATS_ENABLED)) {
|
||
- usageStatsPref.setOnPreferenceClickListener(preference -> {
|
||
- UsageStatsConsentDialog
|
||
- .create(getActivity(), true,
|
||
- (didConfirm) -> {
|
||
- if (didConfirm) {
|
||
- updateSummaries();
|
||
- }
|
||
- })
|
||
- .show();
|
||
- return true;
|
||
- });
|
||
- } else {
|
||
- getPreferenceScreen().removePreference(usageStatsPref);
|
||
- }
|
||
- }
|
||
}
|
||
|
||
private ChromeManagedPreferenceDelegate createManagedPreferenceDelegate() {
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java
|
||
@@ -6,8 +6,6 @@ package org.chromium.chrome.browser.safe_browsing;
|
||
import android.content.Context;
|
||
|
||
import org.chromium.base.annotations.CalledByNative;
|
||
-import org.chromium.chrome.browser.safe_browsing.metrics.SettingsAccessPoint;
|
||
-import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment;
|
||
import org.chromium.chrome.browser.settings.SettingsLauncher;
|
||
import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
|
||
import org.chromium.content_public.browser.WebContents;
|
||
@@ -21,12 +19,5 @@ public class SafeBrowsingSettingsLauncher {
|
||
|
||
@CalledByNative
|
||
private static void showSafeBrowsingSettings(WebContents webContents) {
|
||
- WindowAndroid window = webContents.getTopLevelNativeWindow();
|
||
- if (window == null) return;
|
||
- Context currentContext = window.getContext().get();
|
||
- SettingsLauncher settingsLauncher = new SettingsLauncherImpl();
|
||
- settingsLauncher.launchSettingsActivity(currentContext, SafeBrowsingSettingsFragment.class,
|
||
- SafeBrowsingSettingsFragment.createArguments(
|
||
- SettingsAccessPoint.SECURITY_INTERSTITIAL));
|
||
}
|
||
}
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java
|
||
@@ -29,7 +29,6 @@ import org.chromium.chrome.browser.preferences.Pref;
|
||
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
|
||
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
|
||
import org.chromium.chrome.browser.profiles.Profile;
|
||
-import org.chromium.chrome.browser.safe_browsing.SafeBrowsingBridge;
|
||
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
|
||
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
|
||
import org.chromium.chrome.browser.signin.SignOutDialogFragment;
|
||
@@ -254,9 +253,6 @@ public class GoogleServicesSettings
|
||
} else if (PREF_PASSWORD_LEAK_DETECTION.equals(key)) {
|
||
assert !mIsSecurityPreferenceRemoved;
|
||
mPrefService.setBoolean(Pref.PASSWORD_LEAK_DETECTION_ENABLED, (boolean) newValue);
|
||
- } else if (PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
|
||
- assert !mIsSecurityPreferenceRemoved;
|
||
- SafeBrowsingBridge.setSafeBrowsingExtendedReportingEnabled((boolean) newValue);
|
||
} else if (PREF_NAVIGATION_ERROR.equals(key)) {
|
||
mPrefService.setBoolean(Pref.ALTERNATE_ERROR_PAGES_ENABLED, (boolean) newValue);
|
||
} else if (PREF_USAGE_AND_CRASH_REPORTING.equals(key)) {
|
||
@@ -309,8 +305,7 @@ public class GoogleServicesSettings
|
||
assert !mIsSecurityPreferenceRemoved;
|
||
boolean safe_browsing_enabled = mPrefService.getBoolean(Pref.SAFE_BROWSING_ENABLED);
|
||
mSafeBrowsingReporting.setEnabled(safe_browsing_enabled);
|
||
- mSafeBrowsingReporting.setChecked(safe_browsing_enabled
|
||
- && SafeBrowsingBridge.isSafeBrowsingExtendedReportingEnabled());
|
||
+ mSafeBrowsingReporting.setChecked(safe_browsing_enabled);
|
||
|
||
boolean has_token_for_leak_check = PasswordUIView.hasAccountForLeakCheckRequest();
|
||
boolean leak_detection_enabled =
|
||
@@ -340,9 +335,6 @@ public class GoogleServicesSettings
|
||
if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
|
||
return mPrefService.isManagedPreference(Pref.SEARCH_SUGGEST_ENABLED);
|
||
}
|
||
- if (PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
|
||
- return SafeBrowsingBridge.isSafeBrowsingExtendedReportingManaged();
|
||
- }
|
||
if (PREF_SAFE_BROWSING.equals(key)) {
|
||
return mPrefService.isManagedPreference(Pref.SAFE_BROWSING_ENABLED);
|
||
}
|
||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
|
||
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
|
||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
|
||
@@ -47,7 +47,6 @@ import org.chromium.chrome.browser.preferences.Pref;
|
||
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
|
||
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
|
||
import org.chromium.chrome.browser.profiles.Profile;
|
||
-import org.chromium.chrome.browser.safe_browsing.SafeBrowsingBridge;
|
||
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
|
||
import org.chromium.chrome.browser.settings.SettingsActivity;
|
||
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
|
||
@@ -108,8 +107,6 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
public static final String PREF_SAFE_BROWSING = "safe_browsing";
|
||
@VisibleForTesting
|
||
public static final String PREF_PASSWORD_LEAK_DETECTION = "password_leak_detection";
|
||
- @VisibleForTesting
|
||
- public static final String PREF_SAFE_BROWSING_SCOUT_REPORTING = "safe_browsing_scout_reporting";
|
||
private static final String PREF_USAGE_AND_CRASH_REPORTING = "usage_and_crash_reports";
|
||
private static final String PREF_URL_KEYED_ANONYMIZED_DATA = "url_keyed_anonymized_data";
|
||
private static final String PREF_CONTEXTUAL_SEARCH = "contextual_search";
|
||
@@ -224,7 +221,6 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
if (mIsSafeBrowsingPreferenceRemoved) {
|
||
removePreference(servicesCategory, findPreference(PREF_SAFE_BROWSING));
|
||
removePreference(servicesCategory, findPreference(PREF_PASSWORD_LEAK_DETECTION));
|
||
- removePreference(servicesCategory, findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING));
|
||
mSafeBrowsing = null;
|
||
mPasswordLeakDetection = null;
|
||
mSafeBrowsingReporting = null;
|
||
@@ -238,8 +234,6 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
mPasswordLeakDetection.setOnPreferenceChangeListener(this);
|
||
mPasswordLeakDetection.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
||
|
||
- mSafeBrowsingReporting =
|
||
- (ChromeSwitchPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
|
||
mSafeBrowsingReporting.setOnPreferenceChangeListener(this);
|
||
mSafeBrowsingReporting.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
||
}
|
||
@@ -406,9 +400,6 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
} else if (PREF_PASSWORD_LEAK_DETECTION.equals(key)) {
|
||
assert !mIsSafeBrowsingPreferenceRemoved;
|
||
mPrefService.setBoolean(Pref.PASSWORD_LEAK_DETECTION_ENABLED, (boolean) newValue);
|
||
- } else if (PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
|
||
- assert !mIsSafeBrowsingPreferenceRemoved;
|
||
- SafeBrowsingBridge.setSafeBrowsingExtendedReportingEnabled((boolean) newValue);
|
||
} else if (PREF_NAVIGATION_ERROR.equals(key)) {
|
||
mPrefService.setBoolean(Pref.ALTERNATE_ERROR_PAGES_ENABLED, (boolean) newValue);
|
||
} else if (PREF_USAGE_AND_CRASH_REPORTING.equals(key)) {
|
||
@@ -662,8 +653,7 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
assert !mIsSafeBrowsingPreferenceRemoved;
|
||
boolean safe_browsing_enabled = mPrefService.getBoolean(Pref.SAFE_BROWSING_ENABLED);
|
||
mSafeBrowsingReporting.setEnabled(safe_browsing_enabled);
|
||
- mSafeBrowsingReporting.setChecked(safe_browsing_enabled
|
||
- && SafeBrowsingBridge.isSafeBrowsingExtendedReportingEnabled());
|
||
+ mSafeBrowsingReporting.setChecked(safe_browsing_enabled);
|
||
|
||
boolean has_token_for_leak_check = PasswordUIView.hasAccountForLeakCheckRequest();
|
||
boolean leak_detection_enabled =
|
||
@@ -690,9 +680,6 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
|
||
if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
|
||
return mPrefService.isManagedPreference(Pref.SEARCH_SUGGEST_ENABLED);
|
||
}
|
||
- if (PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
|
||
- return SafeBrowsingBridge.isSafeBrowsingExtendedReportingManaged();
|
||
- }
|
||
if (PREF_SAFE_BROWSING.equals(key)) {
|
||
return mPrefService.isManagedPreference(Pref.SAFE_BROWSING_ENABLED);
|
||
}
|
||
diff --git a/chrome/app/android/chrome_main_delegate_android.cc b/chrome/app/android/chrome_main_delegate_android.cc
|
||
--- a/chrome/app/android/chrome_main_delegate_android.cc
|
||
+++ b/chrome/app/android/chrome_main_delegate_android.cc
|
||
@@ -6,6 +6,7 @@
|
||
|
||
#include "base/android/jni_android.h"
|
||
#include "base/base_paths_android.h"
|
||
+#include "base/feature_list.h"
|
||
#include "base/files/file_path.h"
|
||
#include "base/files/file_util.h"
|
||
#include "base/logging.h"
|
||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||
--- a/chrome/browser/BUILD.gn
|
||
+++ b/chrome/browser/BUILD.gn
|
||
@@ -1134,8 +1134,6 @@ static_library("browser") {
|
||
"permissions/adaptive_quiet_notification_permission_ui_enabler.h",
|
||
"permissions/chrome_permissions_client.cc",
|
||
"permissions/chrome_permissions_client.h",
|
||
- "permissions/contextual_notification_permission_ui_selector.cc",
|
||
- "permissions/contextual_notification_permission_ui_selector.h",
|
||
"permissions/crowd_deny_preload_data.cc",
|
||
"permissions/crowd_deny_preload_data.h",
|
||
"permissions/crowd_deny_safe_browsing_request.cc",
|
||
@@ -1487,17 +1485,6 @@ static_library("browser") {
|
||
"renderer_host/chrome_navigation_ui_data.h",
|
||
"renderer_preferences_util.cc",
|
||
"renderer_preferences_util.h",
|
||
- "reputation/local_heuristics.cc",
|
||
- "reputation/local_heuristics.h",
|
||
- "reputation/reputation_service.cc",
|
||
- "reputation/reputation_service.h",
|
||
- "reputation/reputation_web_contents_observer.cc",
|
||
- "reputation/reputation_web_contents_observer.h",
|
||
- "reputation/safety_tip_ui.h",
|
||
- "reputation/safety_tip_ui_helper.cc",
|
||
- "reputation/safety_tip_ui_helper.h",
|
||
- "reputation/url_elision_policy.cc",
|
||
- "reputation/url_elision_policy.h",
|
||
"resource_coordinator/resource_coordinator_parts.cc",
|
||
"resource_coordinator/resource_coordinator_parts.h",
|
||
"resource_coordinator/session_restore_policy.cc",
|
||
@@ -2125,8 +2112,6 @@ static_library("browser") {
|
||
"//components/reading_list/core",
|
||
"//components/reading_list/features:flags",
|
||
"//components/renderer_context_menu",
|
||
- "//components/reputation/core",
|
||
- "//components/reputation/core:proto",
|
||
"//components/resources",
|
||
"//components/safe_browsing/content/browser",
|
||
"//components/safe_browsing/content/password_protection",
|
||
@@ -3121,10 +3106,6 @@ static_library("browser") {
|
||
"profiles/profile_manager_android.cc",
|
||
"profiles/profile_manager_android.h",
|
||
"query_tiles/android/tile_provider_factory.cc",
|
||
- "reputation/safety_tip_infobar.cc",
|
||
- "reputation/safety_tip_infobar.h",
|
||
- "reputation/safety_tip_infobar_delegate.cc",
|
||
- "reputation/safety_tip_infobar_delegate.h",
|
||
"safe_browsing/android/password_reuse_controller_android.cc",
|
||
"safe_browsing/android/password_reuse_controller_android.h",
|
||
"safe_browsing/android/safe_browsing_settings_launcher_android.cc",
|
||
@@ -3449,8 +3430,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",
|
||
@@ -6619,8 +6598,6 @@ static_library("test_support") {
|
||
"//components/policy/core/browser:test_support",
|
||
"//components/policy/proto:reporting_record_proto",
|
||
"//components/prefs:test_support",
|
||
- "//components/reputation/core",
|
||
- "//components/reputation/core:proto",
|
||
"//components/safe_browsing/core:csd_proto",
|
||
"//components/search_engines:test_support",
|
||
"//components/security_interstitials/content:security_interstitial_page",
|
||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||
--- a/chrome/browser/about_flags.cc
|
||
+++ b/chrome/browser/about_flags.cc
|
||
@@ -2049,7 +2049,7 @@ const FeatureEntry::FeatureParam
|
||
{QuietNotificationPermissionUiConfig::kEnableAbusiveRequestWarning,
|
||
"true"},
|
||
{QuietNotificationPermissionUiConfig::kEnableCrowdDenyTriggering,
|
||
- "true"},
|
||
+ "false"},
|
||
{QuietNotificationPermissionUiConfig::kCrowdDenyHoldBackChance, "0"}};
|
||
|
||
// The default "Enabled" option has the semantics of showing the quiet UI
|
||
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc
|
||
--- a/chrome/browser/android/tab_web_contents_delegate_android.cc
|
||
+++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
|
||
@@ -39,7 +39,9 @@
|
||
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
|
||
#include "chrome/browser/prefetch/no_state_prefetch/prerender_manager_factory.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h"
|
||
+#endif
|
||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||
#include "chrome/browser/ui/android/infobars/chrome_confirm_infobar.h"
|
||
#include "chrome/browser/ui/android/infobars/framebust_block_infobar.h"
|
||
@@ -173,8 +175,10 @@ void TabWebContentsDelegateAndroid::PortalWebContentsCreated(
|
||
InfoBarService::CreateForWebContents(portal_contents);
|
||
PrefsTabHelper::CreateForWebContents(portal_contents);
|
||
DataReductionProxyTabHelper::CreateForWebContents(portal_contents);
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
safe_browsing::SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
|
||
portal_contents);
|
||
+#endif
|
||
}
|
||
|
||
void TabWebContentsDelegateAndroid::RunFileChooser(
|
||
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
|
||
--- a/chrome/browser/browser_process.h
|
||
+++ b/chrome/browser/browser_process.h
|
||
@@ -49,10 +49,6 @@ class NetworkQualityTracker;
|
||
class SharedURLLoaderFactory;
|
||
}
|
||
|
||
-namespace safe_browsing {
|
||
-class SafeBrowsingService;
|
||
-}
|
||
-
|
||
namespace subresource_filter {
|
||
class RulesetService;
|
||
}
|
||
@@ -216,9 +212,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*
|
||
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
|
||
--- a/chrome/browser/browser_process_impl.cc
|
||
+++ b/chrome/browser/browser_process_impl.cc
|
||
@@ -67,7 +67,6 @@
|
||
#include "chrome/browser/printing/print_preview_dialog_controller.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"
|
||
@@ -107,7 +106,6 @@
|
||
#include "components/prefs/pref_service.h"
|
||
#include "components/rappor/public/rappor_utils.h"
|
||
#include "components/rappor/rappor_service_impl.h"
|
||
-#include "components/safe_browsing/core/safe_browsing_service_interface.h"
|
||
#include "components/sessions/core/session_id_generator.h"
|
||
#include "components/subresource_filter/content/browser/ruleset_service.h"
|
||
#include "components/translate/core/browser/translate_download_manager.h"
|
||
@@ -377,8 +375,6 @@ void BrowserProcessImpl::StartTearDown() {
|
||
|
||
metrics_services_manager_.reset();
|
||
intranet_redirect_detector_.reset();
|
||
- if (safe_browsing_service_.get())
|
||
- safe_browsing_service()->ShutDown();
|
||
network_time_tracker_.reset();
|
||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||
plugins_resource_service_.reset();
|
||
@@ -985,14 +981,6 @@ StatusTray* BrowserProcessImpl::status_tray() {
|
||
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_);
|
||
@@ -1252,23 +1240,6 @@ void BrowserProcessImpl::CreateBackgroundPrintingManager() {
|
||
}
|
||
|
||
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() {
|
||
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
|
||
--- a/chrome/browser/browser_process_impl.h
|
||
+++ b/chrome/browser/browser_process_impl.h
|
||
@@ -169,7 +169,6 @@ class BrowserProcessImpl : public BrowserProcess,
|
||
void set_background_mode_manager_for_test(
|
||
std::unique_ptr<BackgroundModeManager> manager) override;
|
||
StatusTray* status_tray() override;
|
||
- safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
||
override;
|
||
federated_learning::FlocSortingLshClustersService*
|
||
@@ -319,9 +318,6 @@ class BrowserProcessImpl : public BrowserProcess,
|
||
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_;
|
||
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
|
||
--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
|
||
+++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
|
||
@@ -657,10 +657,12 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
|
||
base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies"));
|
||
|
||
network::mojom::NetworkContext* safe_browsing_context = nullptr;
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
safe_browsing::SafeBrowsingService* sb_service =
|
||
g_browser_process->safe_browsing_service();
|
||
if (sb_service)
|
||
safe_browsing_context = sb_service->GetNetworkContext(profile_);
|
||
+#endif
|
||
|
||
browsing_data::RemoveEmbedderCookieData(
|
||
delete_begin, delete_end, filter_builder, host_content_settings_map_,
|
||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||
@@ -118,12 +118,14 @@
|
||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||
#include "chrome/browser/renderer_preferences_util.h"
|
||
#include "chrome/browser/resource_coordinator/background_tab_navigation_throttle.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "chrome/browser/safe_browsing/certificate_reporting_service.h"
|
||
#include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h"
|
||
#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
|
||
#include "chrome/browser/safe_browsing/delayed_warning_navigation_throttle.h"
|
||
#include "chrome/browser/safe_browsing/safe_browsing_navigation_throttle.h"
|
||
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
||
+#endif
|
||
#include "chrome/browser/safe_browsing/ui_manager.h"
|
||
#include "chrome/browser/safe_browsing/url_checker_delegate_impl.h"
|
||
#include "chrome/browser/safe_browsing/url_lookup_service_factory.h"
|
||
@@ -910,21 +912,13 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
||
class CertificateReportingServiceCertReporter : public SSLCertReporter {
|
||
public:
|
||
explicit CertificateReportingServiceCertReporter(
|
||
- content::WebContents* web_contents)
|
||
- : service_(CertificateReportingServiceFactory::GetForBrowserContext(
|
||
- web_contents->GetBrowserContext())) {}
|
||
+ content::WebContents* web_contents) {}
|
||
~CertificateReportingServiceCertReporter() override {}
|
||
|
||
// SSLCertReporter implementation
|
||
void ReportInvalidCertificateChain(
|
||
const std::string& serialized_report) override {
|
||
- service_->Send(serialized_report);
|
||
}
|
||
-
|
||
- private:
|
||
- CertificateReportingService* service_;
|
||
-
|
||
- DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceCertReporter);
|
||
};
|
||
|
||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||
@@ -1450,7 +1444,9 @@ void ChromeContentBrowserClient::PostAfterStartupTask(
|
||
InitNetworkContextsParentDirectory();
|
||
|
||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
safe_browsing_service_ = g_browser_process->safe_browsing_service();
|
||
+#endif
|
||
}
|
||
|
||
bool ChromeContentBrowserClient::IsBrowserStartupComplete() {
|
||
@@ -2170,7 +2166,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||
}
|
||
#elif defined(OS_POSIX)
|
||
#if defined(OS_ANDROID)
|
||
- bool enable_crash_reporter = true;
|
||
+ bool enable_crash_reporter = false;
|
||
#else
|
||
bool enable_crash_reporter = false;
|
||
if (crash_reporter::IsCrashpadEnabled()) {
|
||
@@ -2294,6 +2290,9 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||
instant_service->IsInstantProcess(process->GetID())) {
|
||
command_line->AppendSwitch(switches::kInstantProcess);
|
||
}
|
||
+#else
|
||
+ command_line->AppendSwitch(
|
||
+ switches::kDisableClientSidePhishingDetection);
|
||
#endif
|
||
|
||
if (prefs->HasPrefPath(prefs::kAllowDinosaurEasterEgg) &&
|
||
@@ -4073,14 +4072,13 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||
&throttles);
|
||
#endif
|
||
|
||
- throttles.push_back(
|
||
- std::make_unique<safe_browsing::SafeBrowsingNavigationThrottle>(handle));
|
||
-
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
if (base::FeatureList::IsEnabled(safe_browsing::kDelayedWarnings)) {
|
||
throttles.push_back(
|
||
std::make_unique<safe_browsing::DelayedWarningNavigationThrottle>(
|
||
handle));
|
||
}
|
||
+#endif
|
||
|
||
#if defined(OS_WIN) || defined(OS_MAC) || \
|
||
(defined(OS_LINUX) && !defined(OS_CHROMEOS))
|
||
@@ -5191,6 +5189,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||
bool should_check_on_sb_disabled) {
|
||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
// Should not bypass safe browsing check if the check is for enterprise
|
||
// lookup.
|
||
if (!safe_browsing_enabled_for_profile && !should_check_on_sb_disabled)
|
||
@@ -5205,6 +5204,9 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||
}
|
||
|
||
return safe_browsing_url_checker_delegate_;
|
||
+#else
|
||
+ return nullptr;
|
||
+#endif
|
||
}
|
||
|
||
safe_browsing::RealTimeUrlLookupServiceBase*
|
||
diff --git a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
|
||
--- a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
|
||
+++ b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
|
||
@@ -73,6 +73,7 @@
|
||
|
||
namespace {
|
||
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
// Helper method for ExposeInterfacesToRenderer() that checks the latest
|
||
// SafeBrowsing pref value on the UI thread before hopping over to the IO
|
||
// thread.
|
||
@@ -105,6 +106,7 @@ void MaybeCreateSafeBrowsingForRenderer(
|
||
/*should_check_on_sb_disabled=*/false),
|
||
std::move(receiver)));
|
||
}
|
||
+#endif
|
||
|
||
} // namespace
|
||
|
||
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
|
||
@@ -20,7 +20,9 @@
|
||
#include "base/task/thread_pool.h"
|
||
#include "base/version.h"
|
||
#include "components/component_updater/component_updater_paths.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/file_type_policies.h"
|
||
+#endif
|
||
|
||
using component_updater::ComponentUpdateService;
|
||
|
||
@@ -39,20 +41,6 @@ const uint8_t kFileTypePoliciesPublicKeySHA256[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
|
||
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
|
||
@@ -47,9 +47,11 @@
|
||
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_factory.h"
|
||
#include "chrome/browser/platform_util.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
|
||
#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/chrome_pages.h"
|
||
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
|
||
#include "chrome/common/buildflags.h"
|
||
@@ -69,7 +71,9 @@
|
||
#include "components/prefs/pref_member.h"
|
||
#include "components/prefs/pref_service.h"
|
||
#include "components/safe_browsing/buildflags.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/file_type_policies.h"
|
||
+#endif
|
||
#include "components/services/quarantine/public/mojom/quarantine.mojom.h"
|
||
#include "components/services/quarantine/quarantine_impl.h"
|
||
#include "content/public/browser/browser_task_traits.h"
|
||
@@ -129,8 +133,10 @@ using content::DownloadManager;
|
||
using download::DownloadItem;
|
||
using download::DownloadPathReservationTracker;
|
||
using download::PathValidationResult;
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
using safe_browsing::DownloadFileType;
|
||
using safe_browsing::DownloadProtectionService;
|
||
+#endif
|
||
|
||
namespace {
|
||
|
||
@@ -328,12 +334,12 @@ void HandleMixedDownloadInfoBarResult(
|
||
}
|
||
#endif
|
||
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
void MaybeReportDangerousDownloadBlocked(
|
||
DownloadPrefs::DownloadRestriction download_restriction,
|
||
std::string danger_type,
|
||
std::string download_path,
|
||
download::DownloadItem* download) {
|
||
-#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
if (download_restriction !=
|
||
DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES &&
|
||
download_restriction !=
|
||
@@ -363,8 +369,8 @@ void MaybeReportDangerousDownloadBlocked(
|
||
base::HexEncode(raw_digest_sha256.data(), raw_digest_sha256.size()),
|
||
danger_type, download->GetMimeType(), download->GetTotalBytes(),
|
||
safe_browsing::EventResult::BLOCKED);
|
||
-#endif
|
||
}
|
||
+#endif
|
||
|
||
} // namespace
|
||
|
||
@@ -386,13 +392,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);
|
||
- }
|
||
}
|
||
|
||
#if defined(OS_ANDROID)
|
||
@@ -733,16 +732,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::SanitizeDownloadParameters(
|
||
@@ -855,18 +844,18 @@ ChromeDownloadManagerDelegate::ApplicationClientIdForFileScanning() {
|
||
return std::string(chrome::kApplicationClientIDStringForAVScanning);
|
||
}
|
||
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
DownloadProtectionService*
|
||
ChromeDownloadManagerDelegate::GetDownloadProtectionService() {
|
||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||
-#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
safe_browsing::SafeBrowsingService* sb_service =
|
||
g_browser_process->safe_browsing_service();
|
||
if (sb_service && sb_service->download_protection_service()) {
|
||
return sb_service->download_protection_service();
|
||
}
|
||
-#endif
|
||
return nullptr;
|
||
}
|
||
+#endif
|
||
|
||
void ChromeDownloadManagerDelegate::GetMixedContentStatus(
|
||
download::DownloadItem* download,
|
||
@@ -1405,8 +1394,11 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
|
||
DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true);
|
||
#endif
|
||
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
DownloadItemModel(item).SetDangerLevel(target_info->danger_level);
|
||
+#endif
|
||
}
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
if (ShouldBlockFile(target_info->danger_type, item)) {
|
||
MaybeReportDangerousDownloadBlocked(
|
||
download_prefs_->download_restriction(), "DANGEROUS_FILE_TYPE",
|
||
@@ -1415,6 +1407,7 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
|
||
// A dangerous type would take precedence over the blocking of the file.
|
||
target_info->danger_type = download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS;
|
||
}
|
||
+#endif
|
||
|
||
base::FilePath target_path = target_info->target_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_completion_blocker.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 "components/download/public/common/download_path_reservation_tracker.h"
|
||
@@ -138,7 +140,7 @@ class ChromeDownloadManagerDelegate
|
||
|
||
DownloadPrefs* download_prefs() { return download_prefs_.get(); }
|
||
|
||
-#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
// The state of a safebrowsing check.
|
||
class SafeBrowsingState : public DownloadCompletionBlocker {
|
||
public:
|
||
@@ -152,11 +154,11 @@ class ChromeDownloadManagerDelegate
|
||
private:
|
||
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingState);
|
||
};
|
||
-#endif // FULL_SAFE_BROWSING
|
||
|
||
// Callback function after the DownloadProtectionService completes.
|
||
void CheckClientDownloadDone(uint32_t download_id,
|
||
safe_browsing::DownloadCheckResult result);
|
||
+#endif // FULL_SAFE_BROWSING
|
||
|
||
base::WeakPtr<ChromeDownloadManagerDelegate> GetWeakPtr();
|
||
|
||
@@ -164,8 +166,10 @@ class ChromeDownloadManagerDelegate
|
||
mojo::PendingReceiver<quarantine::mojom::Quarantine> receiver);
|
||
|
||
protected:
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
virtual safe_browsing::DownloadProtectionService*
|
||
GetDownloadProtectionService();
|
||
+#endif
|
||
|
||
// Show file picker for |download|.
|
||
virtual void ShowFilePickerForDownload(
|
||
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
|
||
@@ -28,15 +28,19 @@
|
||
#include "chrome/browser/enterprise/connectors/connectors_manager.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/deep_scanning_request.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "chrome/browser/safe_browsing/download_protection/download_feedback_service.h"
|
||
+#endif
|
||
#include "chrome/grit/chromium_strings.h"
|
||
#include "chrome/grit/generated_resources.h"
|
||
#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"
|
||
#include "components/safe_browsing/buildflags.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/file_type_policies.h"
|
||
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
|
||
+#endif
|
||
#include "content/public/browser/download_item_utils.h"
|
||
#include "ui/base/l10n/l10n_util.h"
|
||
#include "ui/base/l10n/time_format.h"
|
||
@@ -49,7 +53,9 @@
|
||
using base::TimeDelta;
|
||
using download::DownloadItem;
|
||
using MixedContentStatus = download::DownloadItem::MixedContentStatus;
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
using safe_browsing::DownloadFileType;
|
||
+#endif
|
||
|
||
namespace {
|
||
|
||
@@ -79,9 +85,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_;
|
||
@@ -118,7 +126,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
|
||
@@ -372,6 +382,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;
|
||
@@ -382,6 +393,7 @@ void DownloadItemModel::SetDangerLevel(
|
||
DownloadItemModelData* data = DownloadItemModelData::GetOrCreate(download_);
|
||
data->danger_level_ = danger_level;
|
||
}
|
||
+#endif
|
||
|
||
download::DownloadItem::MixedContentStatus
|
||
DownloadItemModel::GetMixedContentStatus() const {
|
||
@@ -539,9 +551,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() &&
|
||
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
|
||
@@ -13,7 +13,9 @@
|
||
#include "chrome/browser/download/download_ui_model.h"
|
||
#include "components/download/public/common/download_item.h"
|
||
#include "components/safe_browsing/buildflags.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
|
||
+#endif
|
||
|
||
// Implementation of DownloadUIModel that wrappers around a |DownloadItem*|. As
|
||
// such, the caller is expected to ensure that the |download| passed into the
|
||
@@ -50,9 +52,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
|
||
download::DownloadItem::MixedContentStatus GetMixedContentStatus()
|
||
const override;
|
||
void OpenUsingPlatformHandler() 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
|
||
@@ -41,7 +41,9 @@
|
||
#include "components/policy/core/browser/url_blocklist_manager.h"
|
||
#include "components/pref_registry/pref_registry_syncable.h"
|
||
#include "components/prefs/pref_service.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/file_type_policies.h"
|
||
+#endif
|
||
#include "content/public/browser/browser_thread.h"
|
||
#include "content/public/browser/download_manager.h"
|
||
#include "content/public/browser/save_page_type.h"
|
||
@@ -60,7 +62,9 @@
|
||
using content::BrowserContext;
|
||
using content::BrowserThread;
|
||
using content::DownloadManager;
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
using safe_browsing::FileTypePolicies;
|
||
+#endif
|
||
|
||
namespace {
|
||
|
||
@@ -265,14 +269,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_by_user_.insert(extension);
|
||
- }
|
||
+ auto_open_by_user_.insert(extension);
|
||
}
|
||
}
|
||
|
||
@@ -472,10 +469,6 @@ bool DownloadPrefs::IsAutoOpenByPolicy(const GURL& url,
|
||
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);
|
||
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
|
||
@@ -28,7 +28,9 @@
|
||
#include "components/download/public/common/download_interrupt_reasons.h"
|
||
#include "components/history/core/browser/history_service.h"
|
||
#include "components/prefs/pref_service.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/file_type_policies.h"
|
||
+#endif
|
||
#include "content/public/browser/browser_context.h"
|
||
#include "content/public/browser/browser_task_traits.h"
|
||
#include "content/public/browser/browser_thread.h"
|
||
@@ -61,13 +63,16 @@
|
||
using content::BrowserThread;
|
||
using download::DownloadItem;
|
||
using download::DownloadPathReservationTracker;
|
||
+#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
|
||
@@ -78,6 +83,7 @@ void VisitCountsToVisitedBefore(base::OnceCallback<void(bool)> callback,
|
||
result.success && result.count > 0 &&
|
||
(result.first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
|
||
}
|
||
+#endif
|
||
|
||
#if defined(OS_WIN)
|
||
// Keeps track of whether Adobe Reader is up to date.
|
||
@@ -102,7 +108,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)
|
||
@@ -292,12 +300,14 @@ base::FilePath DownloadTargetDeterminer::GenerateFileName() const {
|
||
download_->GetURL(), download_->GetContentDisposition(), referrer_charset,
|
||
suggested_filename, sniffed_mime_type, default_filename);
|
||
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
// We don't replace the file extension if safe 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;
|
||
}
|
||
+#endif
|
||
|
||
// If no mime type or explicitly specified a name, don't replace file
|
||
// extension.
|
||
@@ -813,6 +823,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
|
||
@@ -849,6 +860,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;
|
||
}
|
||
|
||
@@ -856,11 +868,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();
|
||
}
|
||
|
||
@@ -965,7 +979,9 @@ void DownloadTargetDeterminer::ScheduleCallbackAndDeleteSelf(
|
||
<< " Intermediate:" << intermediate_path_.AsUTF8Unsafe()
|
||
<< " Confirmation reason:" << static_cast<int>(confirmation_reason_)
|
||
<< " Danger type:" << danger_type_
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
<< " Danger level:" << danger_level_
|
||
+#endif
|
||
<< " Result:" << static_cast<int>(result);
|
||
std::unique_ptr<DownloadTargetInfo> target_info(new DownloadTargetInfo);
|
||
|
||
@@ -977,7 +993,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_;
|
||
@@ -1066,6 +1084,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);
|
||
@@ -1090,30 +1109,9 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel(
|
||
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;
|
||
}
|
||
+#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
|
||
@@ -19,7 +19,9 @@
|
||
#include "components/download/public/common/download_danger_type.h"
|
||
#include "components/download/public/common/download_item.h"
|
||
#include "components/download/public/common/download_path_reservation_tracker.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
|
||
+#endif
|
||
#include "content/public/browser/download_manager_delegate.h"
|
||
#include "ppapi/buildflags/buildflags.h"
|
||
|
||
@@ -316,6 +318,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
|
||
@@ -325,6 +328,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
|
||
|
||
// Generates the download file name based on information from URL, response
|
||
// headers and sniffed mime type.
|
||
@@ -341,7 +345,9 @@ class DownloadTargetDeterminer : public download::DownloadItem::Observer {
|
||
download::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 "components/safe_browsing/core/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),
|
||
mixed_content_status(
|
||
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
|
||
@@ -13,7 +13,9 @@
|
||
#include "components/download/public/common/download_interrupt_reasons.h"
|
||
#include "components/download/public/common/download_item.h"
|
||
#include "components/download/public/common/download_schedule.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
|
||
+#endif
|
||
|
||
struct DownloadTargetInfo {
|
||
DownloadTargetInfo();
|
||
@@ -34,6 +36,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
|
||
@@ -59,6 +62,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
|
||
@@ -32,7 +32,9 @@
|
||
|
||
using base::TimeDelta;
|
||
using download::DownloadItem;
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
using safe_browsing::DownloadFileType;
|
||
+#endif
|
||
using offline_items_collection::FailState;
|
||
|
||
namespace {
|
||
@@ -395,12 +397,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
|
||
|
||
download::DownloadItem::MixedContentStatus
|
||
DownloadUIModel::GetMixedContentStatus() const {
|
||
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
|
||
@@ -17,7 +17,9 @@
|
||
#include "components/download/public/common/download_item.h"
|
||
#include "components/offline_items_collection/core/offline_item.h"
|
||
#include "components/safe_browsing/buildflags.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
|
||
+#endif
|
||
|
||
#if !defined(OS_ANDROID)
|
||
#include "chrome/browser/download/download_commands.h"
|
||
@@ -168,6 +170,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.
|
||
@@ -176,6 +179,7 @@ class DownloadUIModel {
|
||
// Change what's returned by GetDangerLevel().
|
||
virtual void SetDangerLevel(
|
||
safe_browsing::DownloadFileType::DangerLevel danger_level);
|
||
+#endif
|
||
|
||
// Return the mixed content status determined during download target
|
||
// determination.
|
||
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
|
||
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
|
||
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
|
||
@@ -38,7 +38,6 @@
|
||
#include "chrome/browser/browser_process.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"
|
||
@@ -1326,9 +1325,6 @@ DownloadsAcceptDangerFunction::DownloadsAcceptDangerFunction() {}
|
||
|
||
DownloadsAcceptDangerFunction::~DownloadsAcceptDangerFunction() {}
|
||
|
||
-DownloadsAcceptDangerFunction::OnPromptCreatedCallback*
|
||
- DownloadsAcceptDangerFunction::on_prompt_created_ = NULL;
|
||
-
|
||
ExtensionFunction::ResponseAction DownloadsAcceptDangerFunction::Run() {
|
||
std::unique_ptr<downloads::AcceptDanger::Params> params(
|
||
downloads::AcceptDanger::Params::Create(*args_));
|
||
@@ -1366,43 +1362,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_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() {}
|
||
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
|
||
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
|
||
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
|
||
@@ -13,7 +13,6 @@
|
||
#include "base/macros.h"
|
||
#include "base/scoped_observer.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"
|
||
@@ -187,11 +186,6 @@ class DownloadsRemoveFileFunction : public ExtensionFunction {
|
||
|
||
class DownloadsAcceptDangerFunction : public ExtensionFunction {
|
||
public:
|
||
- typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback;
|
||
- static void OnPromptCreatedForTesting(
|
||
- OnPromptCreatedCallback* callback) {
|
||
- on_prompt_created_ = callback;
|
||
- }
|
||
|
||
DECLARE_EXTENSION_FUNCTION("downloads.acceptDanger", DOWNLOADS_ACCEPTDANGER)
|
||
DownloadsAcceptDangerFunction();
|
||
@@ -199,13 +193,10 @@ class DownloadsAcceptDangerFunction : public ExtensionFunction {
|
||
|
||
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);
|
||
};
|
||
|
||
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
|
||
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
|
||
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
|
||
@@ -1035,51 +1035,9 @@ WebstorePrivateGetReferrerChainFunction::
|
||
|
||
ExtensionFunction::ResponseAction
|
||
WebstorePrivateGetReferrerChainFunction::Run() {
|
||
- Profile* profile = chrome_details_.GetProfile();
|
||
- if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(profile))
|
||
- return RespondNow(ArgumentList(
|
||
- api::webstore_private::GetReferrerChain::Results::Create("")));
|
||
-
|
||
- content::WebContents* web_contents = GetSenderWebContents();
|
||
- if (!web_contents) {
|
||
- return RespondNow(ErrorWithArguments(
|
||
+ return RespondNow(ErrorWithArguments(
|
||
api::webstore_private::GetReferrerChain::Results::Create(""),
|
||
kWebstoreUserCancelledError));
|
||
- }
|
||
-
|
||
- scoped_refptr<SafeBrowsingNavigationObserverManager>
|
||
- navigation_observer_manager = g_browser_process->safe_browsing_service()
|
||
- ->navigation_observer_manager();
|
||
-
|
||
- safe_browsing::ReferrerChain referrer_chain;
|
||
- SafeBrowsingNavigationObserverManager::AttributionResult result =
|
||
- navigation_observer_manager->IdentifyReferrerChainByWebContents(
|
||
- web_contents, 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, 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::
|
||
diff --git a/chrome/browser/lookalikes/lookalike_url_controller_client.cc b/chrome/browser/lookalikes/lookalike_url_controller_client.cc
|
||
--- a/chrome/browser/lookalikes/lookalike_url_controller_client.cc
|
||
+++ b/chrome/browser/lookalikes/lookalike_url_controller_client.cc
|
||
@@ -9,7 +9,6 @@
|
||
|
||
#include "chrome/browser/browser_process.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
-#include "chrome/browser/reputation/reputation_service.h"
|
||
#include "chrome/common/url_constants.h"
|
||
#include "components/security_interstitials/content/settings_page_helper.h"
|
||
#include "components/security_interstitials/core/metrics_helper.h"
|
||
@@ -56,8 +55,5 @@ void LookalikeUrlControllerClient::GoBack() {
|
||
}
|
||
|
||
void LookalikeUrlControllerClient::Proceed() {
|
||
- ReputationService::Get(
|
||
- Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
|
||
- ->SetUserIgnore(request_url_);
|
||
Reload();
|
||
}
|
||
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
|
||
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
|
||
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
|
||
@@ -777,9 +777,6 @@ void ChromeMetricsServiceClient::RegisterMetricsServiceProviders() {
|
||
metrics_service_->RegisterMetricsProvider(
|
||
std::make_unique<HttpsEngagementMetricsProvider>());
|
||
|
||
- metrics_service_->RegisterMetricsProvider(
|
||
- std::make_unique<CertificateReportingMetricsProvider>());
|
||
-
|
||
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
|
||
metrics_service_->RegisterMetricsProvider(
|
||
std::make_unique<UpgradeMetricsProvider>());
|
||
diff --git a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
|
||
--- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
|
||
+++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
|
||
@@ -20,7 +20,6 @@
|
||
#include "chrome/browser/native_file_system/native_file_system_permission_context_factory.h"
|
||
#include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
-#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
|
||
#include "chrome/browser/ui/native_file_system_dialogs.h"
|
||
#include "chrome/common/chrome_paths.h"
|
||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||
@@ -231,6 +230,7 @@ BindResultCallbackToCurrentSequence(
|
||
base::SequencedTaskRunnerHandle::Get(), std::move(callback));
|
||
}
|
||
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
void DoSafeBrowsingCheckOnUIThread(
|
||
content::GlobalFrameRoutingId frame_id,
|
||
std::unique_ptr<content::NativeFileSystemWriteItem> item,
|
||
@@ -303,6 +303,7 @@ InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) {
|
||
NOTREACHED();
|
||
return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::kBlock;
|
||
}
|
||
+#endif
|
||
|
||
} // namespace
|
||
|
||
@@ -379,6 +380,7 @@ void ChromeNativeFileSystemPermissionContext::ConfirmSensitiveDirectoryAccess(
|
||
std::move(callback)));
|
||
}
|
||
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
void ChromeNativeFileSystemPermissionContext::PerformAfterWriteChecks(
|
||
std::unique_ptr<content::NativeFileSystemWriteItem> item,
|
||
content::GlobalFrameRoutingId frame_id,
|
||
@@ -401,6 +403,7 @@ void ChromeNativeFileSystemPermissionContext::PerformAfterWriteChecks(
|
||
},
|
||
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
|
||
}
|
||
+#endif
|
||
|
||
void ChromeNativeFileSystemPermissionContext::
|
||
DidConfirmSensitiveDirectoryAccess(
|
||
diff --git a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
|
||
--- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
|
||
+++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
|
||
@@ -12,6 +12,7 @@
|
||
#include "components/content_settings/core/common/content_settings_types.h"
|
||
#include "components/keyed_service/core/keyed_service.h"
|
||
#include "components/permissions/permission_util.h"
|
||
+#include "components/safe_browsing/buildflags.h"
|
||
#include "content/public/browser/native_file_system_permission_context.h"
|
||
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
|
||
|
||
@@ -53,10 +54,12 @@ class ChromeNativeFileSystemPermissionContext
|
||
HandleType handle_type,
|
||
content::GlobalFrameRoutingId frame_id,
|
||
base::OnceCallback<void(SensitiveDirectoryResult)> callback) override;
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
void PerformAfterWriteChecks(
|
||
std::unique_ptr<content::NativeFileSystemWriteItem> item,
|
||
content::GlobalFrameRoutingId frame_id,
|
||
base::OnceCallback<void(AfterWriteCheckResult)> callback) override;
|
||
+#endif
|
||
bool CanObtainReadPermission(const url::Origin& origin) override;
|
||
bool CanObtainWritePermission(const url::Origin& origin) override;
|
||
|
||
diff --git a/chrome/browser/net/trial_comparison_cert_verifier_controller.cc b/chrome/browser/net/trial_comparison_cert_verifier_controller.cc
|
||
--- a/chrome/browser/net/trial_comparison_cert_verifier_controller.cc
|
||
+++ b/chrome/browser/net/trial_comparison_cert_verifier_controller.cc
|
||
@@ -131,9 +131,6 @@ void TrialComparisonCertVerifierController::SendTrialReport(
|
||
std::string serialized_report;
|
||
if (!report.Serialize(&serialized_report))
|
||
return;
|
||
-
|
||
- CertificateReportingServiceFactory::GetForBrowserContext(profile_)->Send(
|
||
- serialized_report);
|
||
}
|
||
|
||
// static
|
||
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
||
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
|
||
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
||
@@ -1423,6 +1423,7 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage(
|
||
is_enabled = false;
|
||
}
|
||
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
// SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing
|
||
// warnings until user interaction. If the current page has a delayed warning,
|
||
// it'll have a user interaction observer attached. Disable password
|
||
@@ -1433,6 +1434,7 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage(
|
||
observer->OnPasswordSaveOrAutofillDenied();
|
||
is_enabled = false;
|
||
}
|
||
+#endif
|
||
|
||
if (log_manager_->IsLoggingActive()) {
|
||
password_manager::BrowserSavePasswordProgressLogger logger(
|
||
diff --git a/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc b/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc
|
||
--- a/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc
|
||
+++ b/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc
|
||
@@ -120,6 +120,7 @@ void AbusiveOriginPermissionRevocationRequest::CheckAndRevokeIfAbusive() {
|
||
return;
|
||
}
|
||
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
CrowdDenyPreloadData* crowd_deny = CrowdDenyPreloadData::GetInstance();
|
||
permissions::PermissionUmaUtil::RecordCrowdDenyIsLoadedAtAbuseCheckTime(
|
||
crowd_deny->is_loaded_from_disk());
|
||
@@ -145,6 +146,7 @@ void AbusiveOriginPermissionRevocationRequest::CheckAndRevokeIfAbusive() {
|
||
return;
|
||
}
|
||
}
|
||
+#endif
|
||
|
||
std::move(callback_).Run(Outcome::PERMISSION_NOT_REVOKED);
|
||
}
|
||
diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc
|
||
--- a/chrome/browser/permissions/chrome_permissions_client.cc
|
||
+++ b/chrome/browser/permissions/chrome_permissions_client.cc
|
||
@@ -17,7 +17,6 @@
|
||
#include "chrome/browser/metrics/ukm_background_recorder_service.h"
|
||
#include "chrome/browser/permissions/abusive_origin_permission_revocation_request.h"
|
||
#include "chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h"
|
||
-#include "chrome/browser/permissions/contextual_notification_permission_ui_selector.h"
|
||
#include "chrome/browser/permissions/permission_decision_auto_blocker_factory.h"
|
||
#include "chrome/browser/permissions/permission_manager_factory.h"
|
||
#include "chrome/browser/permissions/prediction_based_permission_ui_selector.h"
|
||
@@ -199,20 +198,6 @@ ChromePermissionsClient::GetOverrideIconId(ContentSettingsType type) {
|
||
return PermissionsClient::GetOverrideIconId(type);
|
||
}
|
||
|
||
-std::vector<std::unique_ptr<permissions::NotificationPermissionUiSelector>>
|
||
-ChromePermissionsClient::CreateNotificationPermissionUiSelectors(
|
||
- content::BrowserContext* browser_context) {
|
||
- std::vector<std::unique_ptr<permissions::NotificationPermissionUiSelector>>
|
||
- selectors;
|
||
- selectors.emplace_back(
|
||
- std::make_unique<ContextualNotificationPermissionUiSelector>());
|
||
- selectors.emplace_back(std::make_unique<PrefNotificationPermissionUiSelector>(
|
||
- Profile::FromBrowserContext(browser_context)));
|
||
- selectors.emplace_back(std::make_unique<PredictionBasedPermissionUiSelector>(
|
||
- Profile::FromBrowserContext(browser_context)));
|
||
- return selectors;
|
||
-}
|
||
-
|
||
void ChromePermissionsClient::OnPromptResolved(
|
||
content::BrowserContext* browser_context,
|
||
permissions::PermissionRequestType request_type,
|
||
diff --git a/chrome/browser/permissions/chrome_permissions_client.h b/chrome/browser/permissions/chrome_permissions_client.h
|
||
--- a/chrome/browser/permissions/chrome_permissions_client.h
|
||
+++ b/chrome/browser/permissions/chrome_permissions_client.h
|
||
@@ -42,9 +42,6 @@ class ChromePermissionsClient : public permissions::PermissionsClient {
|
||
GetUkmSourceIdCallback callback) override;
|
||
permissions::PermissionRequest::IconId GetOverrideIconId(
|
||
ContentSettingsType type) override;
|
||
- std::vector<std::unique_ptr<permissions::NotificationPermissionUiSelector>>
|
||
- CreateNotificationPermissionUiSelectors(
|
||
- content::BrowserContext* browser_context) override;
|
||
void OnPromptResolved(content::BrowserContext* browser_context,
|
||
permissions::PermissionRequestType request_type,
|
||
permissions::PermissionAction action,
|
||
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
|
||
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
|
||
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
|
||
@@ -63,7 +63,6 @@
|
||
#include "chrome/browser/prefs/pref_metrics_service.h"
|
||
#include "chrome/browser/profiles/gaia_info_update_service_factory.h"
|
||
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||
-#include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h"
|
||
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
|
||
#include "chrome/browser/search_engines/template_url_fetcher_factory.h"
|
||
#include "chrome/browser/search_engines/template_url_service_factory.h"
|
||
@@ -249,7 +248,6 @@ void ChromeBrowserMainExtraPartsProfiles::
|
||
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
|
||
CaptivePortalServiceFactory::GetInstance();
|
||
#endif
|
||
- CertificateReportingServiceFactory::GetInstance();
|
||
#if !defined(OS_ANDROID)
|
||
ChromeBrowsingDataLifetimeManagerFactory::GetInstance();
|
||
#endif
|
||
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
|
||
--- a/chrome/browser/profiles/profile_impl.cc
|
||
+++ b/chrome/browser/profiles/profile_impl.cc
|
||
@@ -92,7 +92,6 @@
|
||
#include "chrome/browser/profiles/profile_metrics.h"
|
||
#include "chrome/browser/push_messaging/push_messaging_service_factory.h"
|
||
#include "chrome/browser/push_messaging/push_messaging_service_impl.h"
|
||
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
||
#include "chrome/browser/sharing/sharing_service_factory.h"
|
||
#include "chrome/browser/signin/identity_manager_factory.h"
|
||
#include "chrome/browser/signin/signin_ui_util.h"
|
||
@@ -588,6 +587,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async_prefs) {
|
||
|
||
mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate>
|
||
pref_validation_delegate;
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service(
|
||
g_browser_process->safe_browsing_service());
|
||
if (safe_browsing_service.get()) {
|
||
@@ -599,7 +599,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async_prefs) {
|
||
pref_validation_delegate.InitWithNewPipeAndPassReceiver());
|
||
}
|
||
}
|
||
-
|
||
+#endif
|
||
prefs_ =
|
||
CreatePrefService(pref_registry_, CreateExtensionPrefStore(this, false),
|
||
profile_policy_connector_->policy_service(),
|
||
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn
|
||
--- a/chrome/browser/safe_browsing/BUILD.gn
|
||
+++ b/chrome/browser/safe_browsing/BUILD.gn
|
||
@@ -6,6 +6,7 @@ import("//components/safe_browsing/buildflags.gni")
|
||
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") {
|
||
}
|
||
deps += [ "//extensions/browser" ]
|
||
}
|
||
+ }
|
||
|
||
if (safe_browsing_mode != 0) {
|
||
# "Safe Browsing Basic" files used for safe browsing in full mode
|
||
@@ -129,7 +131,6 @@ static_library("safe_browsing") {
|
||
"//components/safe_browsing/content/triggers:ad_sampler_trigger",
|
||
"//components/safe_browsing/content/triggers:suspicious_site_trigger",
|
||
"//components/safe_browsing/core:csd_proto",
|
||
- "//components/safe_browsing/core:file_type_policies",
|
||
"//components/safe_browsing/core/browser",
|
||
"//components/safe_browsing/core/common",
|
||
"//components/safe_browsing/core/common:safe_browsing_prefs",
|
||
diff --git a/chrome/browser/safe_browsing/android/BUILD.gn b/chrome/browser/safe_browsing/android/BUILD.gn
|
||
--- a/chrome/browser/safe_browsing/android/BUILD.gn
|
||
+++ b/chrome/browser/safe_browsing/android/BUILD.gn
|
||
@@ -15,7 +15,6 @@ source_set("android") {
|
||
"//components/password_manager/core/browser/leak_detection",
|
||
"//components/password_manager/core/common",
|
||
"//components/prefs",
|
||
- "//components/safe_browsing/core:file_type_policies",
|
||
"//components/safe_browsing/core/common:safe_browsing_prefs",
|
||
"//components/signin/public/identity_manager",
|
||
]
|
||
@@ -27,9 +26,7 @@ android_library("java") {
|
||
"java/src/org/chromium/chrome/browser/safe_browsing/settings/EnhancedProtectionSettingsFragment.java",
|
||
"java/src/org/chromium/chrome/browser/safe_browsing/settings/NoProtectionConfirmationDialog.java",
|
||
"java/src/org/chromium/chrome/browser/safe_browsing/settings/RadioButtonGroupSafeBrowsingPreference.java",
|
||
- "java/src/org/chromium/chrome/browser/safe_browsing/settings/SafeBrowsingSettingsFragment.java",
|
||
"java/src/org/chromium/chrome/browser/safe_browsing/settings/SafeBrowsingSettingsFragmentBase.java",
|
||
- "java/src/org/chromium/chrome/browser/safe_browsing/settings/StandardProtectionSettingsFragment.java",
|
||
]
|
||
deps = [
|
||
":java_resources",
|
||
diff --git a/chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingBridge.java b/chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingBridge.java
|
||
--- a/chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingBridge.java
|
||
+++ b/chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingBridge.java
|
||
@@ -12,78 +12,7 @@ import org.chromium.base.annotations.NativeMethods;
|
||
*/
|
||
@JNINamespace("safe_browsing")
|
||
public final class SafeBrowsingBridge {
|
||
- /**
|
||
- * Reports UMA values based on files' extensions.
|
||
- *
|
||
- * @param path The file path.
|
||
- * @return The UMA value for the file.
|
||
- */
|
||
- public static int umaValueForFile(String path) {
|
||
- return SafeBrowsingBridgeJni.get().umaValueForFile(path);
|
||
- }
|
||
-
|
||
- /**
|
||
- * @return Whether Safe Browsing Extended Reporting is currently enabled.
|
||
- */
|
||
- public static boolean isSafeBrowsingExtendedReportingEnabled() {
|
||
- return SafeBrowsingBridgeJni.get().getSafeBrowsingExtendedReportingEnabled();
|
||
- }
|
||
-
|
||
- /**
|
||
- * @param enabled Whether Safe Browsing Extended Reporting should be enabled.
|
||
- */
|
||
- public static void setSafeBrowsingExtendedReportingEnabled(boolean enabled) {
|
||
- SafeBrowsingBridgeJni.get().setSafeBrowsingExtendedReportingEnabled(enabled);
|
||
- }
|
||
-
|
||
- /**
|
||
- * @return Whether Safe Browsing Extended Reporting is managed
|
||
- */
|
||
- public static boolean isSafeBrowsingExtendedReportingManaged() {
|
||
- return SafeBrowsingBridgeJni.get().getSafeBrowsingExtendedReportingManaged();
|
||
- }
|
||
-
|
||
- /**
|
||
- * @return The Safe Browsing state. It can be Enhanced Protection, Standard Protection, or No
|
||
- * Protection.
|
||
- */
|
||
- public static @SafeBrowsingState int getSafeBrowsingState() {
|
||
- return SafeBrowsingBridgeJni.get().getSafeBrowsingState();
|
||
- }
|
||
-
|
||
- /**
|
||
- * @param state Set the Safe Browsing state. It can be Enhanced Protection, Standard Protection,
|
||
- * or No Protection.
|
||
- */
|
||
- public static void setSafeBrowsingState(@SafeBrowsingState int state) {
|
||
- SafeBrowsingBridgeJni.get().setSafeBrowsingState(state);
|
||
- }
|
||
-
|
||
- /**
|
||
- * @return Whether the Safe Browsing preference is managed. It can be managed by either
|
||
- * the SafeBrowsingEnabled policy(legacy) or the SafeBrowsingProtectionLevel policy(new).
|
||
- */
|
||
- public static boolean isSafeBrowsingManaged() {
|
||
- return SafeBrowsingBridgeJni.get().isSafeBrowsingManaged();
|
||
- }
|
||
-
|
||
- /**
|
||
- * @return Whether there is a Google account to use for the leak detection check.
|
||
- */
|
||
- public static boolean hasAccountForLeakCheckRequest() {
|
||
- return SafeBrowsingBridgeJni.get().hasAccountForLeakCheckRequest();
|
||
- }
|
||
-
|
||
@NativeMethods
|
||
interface Natives {
|
||
- int umaValueForFile(String path);
|
||
- boolean getSafeBrowsingExtendedReportingEnabled();
|
||
- void setSafeBrowsingExtendedReportingEnabled(boolean enabled);
|
||
- boolean getSafeBrowsingExtendedReportingManaged();
|
||
- @SafeBrowsingState
|
||
- int getSafeBrowsingState();
|
||
- void setSafeBrowsingState(@SafeBrowsingState int state);
|
||
- boolean hasAccountForLeakCheckRequest();
|
||
- boolean isSafeBrowsingManaged();
|
||
}
|
||
}
|
||
diff --git a/chrome/browser/safe_browsing/android/password_reuse_controller_android.h b/chrome/browser/safe_browsing/android/password_reuse_controller_android.h
|
||
--- a/chrome/browser/safe_browsing/android/password_reuse_controller_android.h
|
||
+++ b/chrome/browser/safe_browsing/android/password_reuse_controller_android.h
|
||
@@ -48,14 +48,18 @@ class PasswordReuseControllerAndroid
|
||
// The following functions are called from |PasswordReuseDialogViewAndroid|,
|
||
// to get text shown on the dialog.
|
||
base::string16 GetButtonText() const;
|
||
+#if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
|
||
// Get the detailed warning text that should show in the modal warning dialog.
|
||
// |placeholder_offsets| are the start points/indices of the placeholders that
|
||
// are passed into the resource string.
|
||
base::string16 GetWarningDetailText(
|
||
std::vector<size_t>* placeholder_offsets) const;
|
||
+#endif
|
||
base::string16 GetTitle() const;
|
||
+#if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
|
||
const std::vector<base::string16> GetPlaceholdersForSavedPasswordWarningText()
|
||
const;
|
||
+#endif
|
||
|
||
// ChromePasswordProtectionService::Observer:
|
||
void OnGaiaPasswordChanged() override;
|
||
@@ -68,7 +72,9 @@ class PasswordReuseControllerAndroid
|
||
|
||
private:
|
||
std::unique_ptr<PasswordReuseDialogViewAndroid> dialog_view_;
|
||
+#if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
|
||
ChromePasswordProtectionService* service_;
|
||
+#endif
|
||
const GURL url_;
|
||
const ReusedPasswordAccountType password_type_;
|
||
ui::WindowAndroid* window_android_;
|
||
diff --git a/chrome/browser/safe_browsing/android/safe_browsing_bridge.cc b/chrome/browser/safe_browsing/android/safe_browsing_bridge.cc
|
||
--- a/chrome/browser/safe_browsing/android/safe_browsing_bridge.cc
|
||
+++ b/chrome/browser/safe_browsing/android/safe_browsing_bridge.cc
|
||
@@ -28,55 +28,4 @@ PrefService* GetPrefService() {
|
||
|
||
namespace safe_browsing {
|
||
|
||
-static jint JNI_SafeBrowsingBridge_UmaValueForFile(
|
||
- JNIEnv* env,
|
||
- const base::android::JavaParamRef<jstring>& path) {
|
||
- base::FilePath file_path(ConvertJavaStringToUTF8(env, path));
|
||
- return safe_browsing::FileTypePolicies::GetInstance()->UmaValueForFile(
|
||
- file_path);
|
||
-}
|
||
-
|
||
-static jboolean JNI_SafeBrowsingBridge_GetSafeBrowsingExtendedReportingEnabled(
|
||
- JNIEnv* env) {
|
||
- return safe_browsing::IsExtendedReportingEnabled(*GetPrefService());
|
||
-}
|
||
-
|
||
-static void JNI_SafeBrowsingBridge_SetSafeBrowsingExtendedReportingEnabled(
|
||
- JNIEnv* env,
|
||
- jboolean enabled) {
|
||
- safe_browsing::SetExtendedReportingPrefAndMetric(
|
||
- GetPrefService(), enabled,
|
||
- safe_browsing::SBER_OPTIN_SITE_ANDROID_SETTINGS);
|
||
-}
|
||
-
|
||
-static jboolean JNI_SafeBrowsingBridge_GetSafeBrowsingExtendedReportingManaged(
|
||
- JNIEnv* env) {
|
||
- PrefService* pref_service = GetPrefService();
|
||
- return pref_service->IsManagedPreference(
|
||
- prefs::kSafeBrowsingScoutReportingEnabled);
|
||
-}
|
||
-
|
||
-static jint JNI_SafeBrowsingBridge_GetSafeBrowsingState(JNIEnv* env) {
|
||
- return safe_browsing::GetSafeBrowsingState(*GetPrefService());
|
||
-}
|
||
-
|
||
-static void JNI_SafeBrowsingBridge_SetSafeBrowsingState(JNIEnv* env,
|
||
- jint state) {
|
||
- return safe_browsing::SetSafeBrowsingState(
|
||
- GetPrefService(), static_cast<SafeBrowsingState>(state));
|
||
-}
|
||
-
|
||
-static jboolean JNI_SafeBrowsingBridge_IsSafeBrowsingManaged(JNIEnv* env) {
|
||
- return safe_browsing::IsSafeBrowsingPolicyManaged(*GetPrefService());
|
||
-}
|
||
-
|
||
-static jboolean JNI_SafeBrowsingBridge_HasAccountForLeakCheckRequest(
|
||
- JNIEnv* env) {
|
||
- signin::IdentityManager* identity_manager =
|
||
- IdentityManagerFactory::GetForProfile(
|
||
- ProfileManager::GetLastUsedProfile());
|
||
- return password_manager::AuthenticatedLeakCheck::HasAccountForRequest(
|
||
- identity_manager);
|
||
-}
|
||
-
|
||
} // namespace safe_browsing
|
||
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
|
||
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
|
||
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
|
||
@@ -20,8 +20,6 @@
|
||
#include "chrome/browser/profiles/profile.h"
|
||
#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
|
||
#include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
|
||
-#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
|
||
-#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service_factory.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/check_client_download_request.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/check_native_file_system_write_request.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/deep_scanning_request.h"
|
||
@@ -604,9 +602,4 @@ void DownloadProtectionService::RequestFinished(DeepScanningRequest* request) {
|
||
deep_scanning_requests_.erase(it);
|
||
}
|
||
|
||
-BinaryUploadService* DownloadProtectionService::GetBinaryUploadService(
|
||
- Profile* profile) {
|
||
- return BinaryUploadServiceFactory::GetForProfile(profile);
|
||
-}
|
||
-
|
||
} // namespace safe_browsing
|
||
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.h b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
|
||
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service.h
|
||
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
|
||
@@ -26,7 +26,6 @@
|
||
#include "base/supports_user_data.h"
|
||
#include "chrome/browser/download/download_commands.h"
|
||
#include "chrome/browser/enterprise/connectors/common.h"
|
||
-#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/deep_scanning_request.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
|
||
#include "chrome/browser/safe_browsing/download_protection/download_reporter.h"
|
||
@@ -281,10 +280,6 @@ class DownloadProtectionService {
|
||
void OnDangerousDownloadOpened(const download::DownloadItem* item,
|
||
Profile* profile);
|
||
|
||
- // Get the BinaryUploadService for the given |profile|. Virtual so it can be
|
||
- // overridden in tests.
|
||
- virtual BinaryUploadService* GetBinaryUploadService(Profile* profile);
|
||
-
|
||
SafeBrowsingService* sb_service_;
|
||
// These pointers may be NULL if SafeBrowsing is disabled.
|
||
scoped_refptr<SafeBrowsingUIManager> ui_manager_;
|
||
diff --git a/chrome/browser/safe_browsing/url_lookup_service_factory.cc b/chrome/browser/safe_browsing/url_lookup_service_factory.cc
|
||
--- a/chrome/browser/safe_browsing/url_lookup_service_factory.cc
|
||
+++ b/chrome/browser/safe_browsing/url_lookup_service_factory.cc
|
||
@@ -50,6 +50,7 @@ RealTimeUrlLookupServiceFactory::RealTimeUrlLookupServiceFactory()
|
||
|
||
KeyedService* RealTimeUrlLookupServiceFactory::BuildServiceInstanceFor(
|
||
content::BrowserContext* context) const {
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
if (!g_browser_process->safe_browsing_service()) {
|
||
return nullptr;
|
||
}
|
||
@@ -74,6 +75,9 @@ KeyedService* RealTimeUrlLookupServiceFactory::BuildServiceInstanceFor(
|
||
GetProfileManagementStatus(browser_policy_connector),
|
||
is_under_advanced_protection, profile->IsOffTheRecord(),
|
||
g_browser_process->variations_service());
|
||
+#else
|
||
+ return nullptr;
|
||
+#endif
|
||
}
|
||
|
||
} // namespace safe_browsing
|
||
diff --git a/chrome/browser/safety_check/android/java/src/org/chromium/chrome/browser/safety_check/SafetyCheckMediator.java b/chrome/browser/safety_check/android/java/src/org/chromium/chrome/browser/safety_check/SafetyCheckMediator.java
|
||
--- a/chrome/browser/safety_check/android/java/src/org/chromium/chrome/browser/safety_check/SafetyCheckMediator.java
|
||
+++ b/chrome/browser/safety_check/android/java/src/org/chromium/chrome/browser/safety_check/SafetyCheckMediator.java
|
||
@@ -31,7 +31,6 @@ import org.chromium.chrome.browser.password_manager.PasswordManagerHelper;
|
||
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
|
||
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
|
||
import org.chromium.chrome.browser.safe_browsing.metrics.SettingsAccessPoint;
|
||
-import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment;
|
||
import org.chromium.chrome.browser.safety_check.SafetyCheckBridge.SafetyCheckCommonObserver;
|
||
import org.chromium.chrome.browser.safety_check.SafetyCheckProperties.PasswordsState;
|
||
import org.chromium.chrome.browser.safety_check.SafetyCheckProperties.SafeBrowsingState;
|
||
@@ -185,30 +184,6 @@ class SafetyCheckMediator implements PasswordCheck.Observer, SafetyCheckCommonOb
|
||
// Set the listener for clicking the Safe Browsing element.
|
||
mModel.set(SafetyCheckProperties.SAFE_BROWSING_CLICK_LISTENER,
|
||
(Preference.OnPreferenceClickListener) (p) -> {
|
||
- // Record UMA metrics.
|
||
- RecordUserAction.record("Settings.SafetyCheck.ManageSafeBrowsing");
|
||
- RecordHistogram.recordEnumeratedHistogram(SAFETY_CHECK_INTERACTIONS,
|
||
- SafetyCheckInteractions.SAFE_BROWSING_MANAGE,
|
||
- SafetyCheckInteractions.MAX_VALUE + 1);
|
||
- String safeBrowsingSettingsClassName;
|
||
- if (ChromeFeatureList.isEnabled(ChromeFeatureList.SAFE_BROWSING_SECTION_UI)) {
|
||
- // Open the Safe Browsing settings since the flag for them is enabled.
|
||
- safeBrowsingSettingsClassName =
|
||
- SafeBrowsingSettingsFragment.class.getName();
|
||
- p.getContext().startActivity(settingsLauncher.createSettingsActivityIntent(
|
||
- p.getContext(), safeBrowsingSettingsClassName,
|
||
- SafeBrowsingSettingsFragment.createArguments(
|
||
- SettingsAccessPoint.SAFETY_CHECK)));
|
||
- } else {
|
||
- // Open the Sync and Services settings.
|
||
- // TODO(crbug.com/1070620): replace the hardcoded class name with an import
|
||
- // and ".class.getName()" once SyncAndServicesSettings is moved out of
|
||
- // //chrome/android.
|
||
- safeBrowsingSettingsClassName =
|
||
- "org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings";
|
||
- p.getContext().startActivity(settingsLauncher.createSettingsActivityIntent(
|
||
- p.getContext(), safeBrowsingSettingsClassName));
|
||
- }
|
||
return true;
|
||
});
|
||
// Set the listener for clicking the passwords element.
|
||
diff --git a/chrome/browser/ssl/sct_reporting_service_factory.cc b/chrome/browser/ssl/sct_reporting_service_factory.cc
|
||
--- a/chrome/browser/ssl/sct_reporting_service_factory.cc
|
||
+++ b/chrome/browser/ssl/sct_reporting_service_factory.cc
|
||
@@ -7,7 +7,6 @@
|
||
#include "base/callback_helpers.h"
|
||
#include "chrome/browser/browser_process.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
||
#include "chrome/browser/ssl/sct_reporting_service.h"
|
||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||
|
||
@@ -32,15 +31,7 @@ SCTReportingServiceFactory::~SCTReportingServiceFactory() = default;
|
||
|
||
KeyedService* SCTReportingServiceFactory::BuildServiceInstanceFor(
|
||
content::BrowserContext* profile) const {
|
||
- safe_browsing::SafeBrowsingService* safe_browsing_service =
|
||
- g_browser_process->safe_browsing_service();
|
||
- // In unit tests the safe browsing service can be null, if this happens,
|
||
- // return null instead of crashing.
|
||
- if (!safe_browsing_service)
|
||
- return nullptr;
|
||
-
|
||
- return new SCTReportingService(safe_browsing_service,
|
||
- static_cast<Profile*>(profile));
|
||
+ return nullptr;
|
||
}
|
||
|
||
content::BrowserContext* SCTReportingServiceFactory::GetBrowserContextToUse(
|
||
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
|
||
--- a/chrome/browser/ssl/security_state_tab_helper.cc
|
||
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
|
||
@@ -15,7 +15,6 @@
|
||
#include "build/build_config.h"
|
||
#include "chrome/browser/browser_process.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
-#include "chrome/browser/reputation/reputation_web_contents_observer.h"
|
||
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
||
#include "chrome/browser/safe_browsing/ui_manager.h"
|
||
#include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
|
||
@@ -167,13 +166,8 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
|
||
// information is still being initialized, thus no need to check for that.
|
||
state->malicious_content_status = GetMaliciousContentStatus();
|
||
|
||
- ReputationWebContentsObserver* reputation_web_contents_observer =
|
||
- ReputationWebContentsObserver::FromWebContents(web_contents());
|
||
state->safety_tip_info =
|
||
- reputation_web_contents_observer
|
||
- ? reputation_web_contents_observer
|
||
- ->GetSafetyTipInfoForVisibleNavigation()
|
||
- : security_state::SafetyTipInfo(
|
||
+ security_state::SafetyTipInfo(
|
||
{security_state::SafetyTipStatus::kUnknown, GURL()});
|
||
|
||
// If both the on-form warning and the on-submit warning are enabled for mixed
|
||
@@ -274,6 +268,7 @@ bool SecurityStateTabHelper::UsedPolicyInstalledCertificate() const {
|
||
|
||
security_state::MaliciousContentStatus
|
||
SecurityStateTabHelper::GetMaliciousContentStatus() const {
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
content::NavigationEntry* entry =
|
||
web_contents()->GetController().GetVisibleEntry();
|
||
if (!entry)
|
||
@@ -360,6 +355,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
|
||
break;
|
||
}
|
||
}
|
||
+#endif
|
||
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
|
||
}
|
||
|
||
diff --git a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
|
||
--- a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
|
||
+++ b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
|
||
@@ -205,10 +205,14 @@ void ChromeSubresourceFilterClient::AllowlistByContentSettings(
|
||
|
||
const scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>
|
||
ChromeSubresourceFilterClient::GetSafeBrowsingDatabaseManager() {
|
||
+#if BUILDFLAG(FULL_SAFE_BROWSING)
|
||
safe_browsing::SafeBrowsingService* safe_browsing_service =
|
||
g_browser_process->safe_browsing_service();
|
||
return safe_browsing_service ? safe_browsing_service->database_manager()
|
||
: nullptr;
|
||
+#else
|
||
+ return nullptr;
|
||
+#endif
|
||
}
|
||
|
||
void ChromeSubresourceFilterClient::ToggleForceActivationInCurrentWebContents(
|
||
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
|
||
--- a/chrome/browser/ui/BUILD.gn
|
||
+++ b/chrome/browser/ui/BUILD.gn
|
||
@@ -3513,7 +3513,6 @@ static_library("ui") {
|
||
"views/device_chooser_content_view.h",
|
||
"views/devtools_process_observer.cc",
|
||
"views/devtools_process_observer.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",
|
||
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||
--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||
+++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||
@@ -339,12 +339,6 @@ CHAR-LIMIT guidelines:
|
||
<message name="IDS_PRELOAD_PAGES_SUMMARY" desc="Summary for a checkbox in Settings that controls pages preloading and informs the user about the data shared by this feature.">
|
||
Uses cookies to remember your preferences, even if you don't visit those pages
|
||
</message>
|
||
- <message name="IDS_NAVIGATION_ERROR_SUGGESTIONS_TITLE" desc="Title for a checkbox in Settings that controls pages suggestions on navigation errors and informs the user about the data shared by this feature.">
|
||
- Show suggestions for similar pages when a page can't be found
|
||
- </message>
|
||
- <message name="IDS_NAVIGATION_ERROR_SUGGESTIONS_SUMMARY" desc="Summary for a checkbox in Settings that controls pages suggestions on navigation errors and informs the user about the data shared by this feature.">
|
||
- Sends the URL of a page you're trying to reach to Google
|
||
- </message>
|
||
<message name="IDS_URL_KEYED_ANONYMIZED_DATA_TITLE" desc="Title for a checkbox in Settings that controls non-personalized URL collection and informs the user about the data shared by this feature.">
|
||
Make searches and browsing better
|
||
</message>
|
||
@@ -360,12 +354,6 @@ CHAR-LIMIT guidelines:
|
||
<message name="IDS_PRIVACY_SYNC_AND_SERVICES_LINK_SYNC_OFF" desc="The text for Privacy preferences that is shown after all preference rows. This version of the text is shown if Sync hasn't been turned on.">
|
||
For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK"><link></ph>Google services<ph name="END_LINK"></link></ph>
|
||
</message>
|
||
- <message name="IDS_USAGE_AND_CRASH_REPORTS_TITLE" desc="Title for a preference that enables sending usage statistics and crash reports.">
|
||
- Help improve Chrome's features and performance
|
||
- </message>
|
||
- <message name="IDS_USAGE_AND_CRASH_REPORTS_SUMMARY" desc="Description for 'Help improve Chrome's features and performance' preference.">
|
||
- Automatically sends usage statistics and crash reports to Google
|
||
- </message>
|
||
<message name="IDS_CANCEL_SYNC_DIALOG_TITLE" desc="The title of a dialog that is shown when users tries closing 'Sync and Google services' preferences without confirming the changes.">
|
||
Cancel sync?
|
||
</message>
|
||
@@ -743,12 +731,6 @@ CHAR-LIMIT guidelines:
|
||
<message name="IDS_PREFS_PRIVACY_SECURITY" desc="Title for the Privacy and Security preferences. [CHAR-LIMIT=32]">
|
||
Privacy and security
|
||
</message>
|
||
- <message name="IDS_SAFE_BROWSING_SCOUT_REPORTING_TITLE" desc="Title for checkbox that controls reporting data to detect bad apps/sites. Please ensure ‘Safe Browsing’ in this message matches the ‘Safe Browsing’ settings title.">
|
||
- Help improve Chrome security
|
||
- </message>
|
||
- <message name="IDS_SAFE_BROWSING_SCOUT_REPORTING_SUMMARY" desc="Body text for Chrome setting under 'Help Improve Safe Browsing'. This feature sends small amounts of data to Google about potentially-dangerous pages to help Safe Browsing improve Chrome's protection against malware and phishing.">
|
||
- To detect dangerous apps and sites, Chrome sends URLs of some pages you visit, limited system information, and some page content to Google
|
||
- </message>
|
||
<message name="IDS_SAFE_BROWSING_TITLE" desc="Title for safe browsing.">
|
||
Safe Browsing (protects you and your device from dangerous sites)
|
||
</message>
|
||
@@ -4010,9 +3992,6 @@ Data from your Incognito session will only be cleared from Chrome when you <ph n
|
||
<message name="IDS_USAGE_STATS_CONSENT_PROMPT" desc="Consent prompt when authorizing Digital Wellbeing to access Chrome usage data">
|
||
You can see sites you visit in Chrome and set timers for them.\n\nGoogle gets info about the sites you set timers for and how long you visit them. This info is used to make Digital Wellbeing better.
|
||
</message>
|
||
- <message name="IDS_USAGE_STATS_SETTING_TITLE" desc="Title for setting removing Digital Wellbeing's access to Chrome usage data">
|
||
- Remove your Chrome activity from Digital Wellbeing
|
||
- </message>
|
||
<message name="IDS_USAGE_STATS_REVOCATION_PROMPT" desc="Prompt for removing Digital Wellbeing's access to Chrome usage data">
|
||
Remove your Chrome activity from Digital Wellbeing?
|
||
</message>
|
||
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc
|
||
--- a/chrome/browser/ui/tab_helpers.cc
|
||
+++ b/chrome/browser/ui/tab_helpers.cc
|
||
@@ -57,11 +57,7 @@
|
||
#include "chrome/browser/previews/resource_loading_hints/resource_loading_hints_web_contents_observer.h"
|
||
#include "chrome/browser/profiles/profile.h"
|
||
#include "chrome/browser/profiles/profile_key.h"
|
||
-#include "chrome/browser/reputation/reputation_web_contents_observer.h"
|
||
#include "chrome/browser/resource_coordinator/tab_helper.h"
|
||
-#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h"
|
||
-#include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h"
|
||
-#include "chrome/browser/safe_browsing/trigger_creator.h"
|
||
#include "chrome/browser/sessions/session_tab_helper_factory.h"
|
||
#include "chrome/browser/ssl/chrome_security_blocking_page_factory.h"
|
||
#include "chrome/browser/ssl/connection_help_tab_helper.h"
|
||
@@ -310,12 +306,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
|
||
resource_coordinator::ResourceCoordinatorTabHelper::CreateForWebContents(
|
||
web_contents);
|
||
ResourceLoadingHintsWebContentsObserver::CreateForWebContents(web_contents);
|
||
- safe_browsing::SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
|
||
- web_contents);
|
||
- safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents);
|
||
- safe_browsing::TriggerCreator::MaybeCreateTriggersForWebContents(
|
||
- profile, web_contents);
|
||
- ReputationWebContentsObserver::CreateForWebContents(web_contents);
|
||
SearchEngineTabHelper::CreateForWebContents(web_contents);
|
||
SecurityStateTabHelper::CreateForWebContents(web_contents);
|
||
if (SiteEngagementService::IsEnabled())
|
||
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
|
||
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
|
||
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
|
||
@@ -287,6 +287,7 @@ CreateInsecureFormPage(content::WebContents* web_contents) {
|
||
request_url));
|
||
}
|
||
|
||
+#if 0
|
||
std::unique_ptr<safe_browsing::SafeBrowsingBlockingPage>
|
||
CreateSafeBrowsingBlockingPage(content::WebContents* web_contents) {
|
||
safe_browsing::SBThreatType threat_type =
|
||
@@ -341,7 +342,9 @@ CreateSafeBrowsingBlockingPage(content::WebContents* web_contents) {
|
||
g_browser_process->safe_browsing_service()->ui_manager().get(),
|
||
web_contents, main_frame_url, resource, true));
|
||
}
|
||
+#endif
|
||
|
||
+#if 0
|
||
std::unique_ptr<TestSafeBrowsingBlockingPageQuiet>
|
||
CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {
|
||
safe_browsing::SBThreatType threat_type =
|
||
@@ -393,6 +396,7 @@ CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {
|
||
g_browser_process->safe_browsing_service()->ui_manager().get(),
|
||
web_contents, main_frame_url, resource, is_giant_webview));
|
||
}
|
||
+#endif
|
||
|
||
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
|
||
std::unique_ptr<CaptivePortalBlockingPage> CreateCaptivePortalBlockingPage(
|
||
@@ -510,8 +514,6 @@ void InterstitialHTMLSource::StartDataRequest(
|
||
interstitial_delegate = CreateBlockedInterceptionBlockingPage(web_contents);
|
||
} else if (path_without_query == "/legacy-tls") {
|
||
interstitial_delegate = CreateLegacyTLSBlockingPage(web_contents);
|
||
- } else if (path_without_query == "/safebrowsing") {
|
||
- interstitial_delegate = CreateSafeBrowsingBlockingPage(web_contents);
|
||
} else if (path_without_query == "/clock") {
|
||
interstitial_delegate = CreateBadClockBlockingPage(web_contents);
|
||
} else if (path_without_query == "/lookalike") {
|
||
@@ -524,13 +526,6 @@ void InterstitialHTMLSource::StartDataRequest(
|
||
interstitial_delegate = CreateOriginPolicyInterstitialPage(web_contents);
|
||
} else if (path_without_query == "/insecure_form") {
|
||
interstitial_delegate = CreateInsecureFormPage(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") {
|
||
html = GetSupervisedUserInterstitialHTML(path);
|
||
diff --git a/chrome/common/safe_browsing/BUILD.gn b/chrome/common/safe_browsing/BUILD.gn
|
||
--- a/chrome/common/safe_browsing/BUILD.gn
|
||
+++ b/chrome/common/safe_browsing/BUILD.gn
|
||
@@ -21,7 +21,6 @@ if (safe_browsing_mode == 1) {
|
||
":download_type_util",
|
||
"//base",
|
||
"//base:i18n",
|
||
- "//components/safe_browsing/core:file_type_policies",
|
||
"//crypto",
|
||
]
|
||
if (is_mac) {
|
||
@@ -38,7 +37,6 @@ if (safe_browsing_mode == 1) {
|
||
deps = [
|
||
"//base",
|
||
"//components/safe_browsing/core:features",
|
||
- "//components/safe_browsing/core:file_type_policies",
|
||
]
|
||
public_deps = [ "//components/safe_browsing/core:csd_proto" ]
|
||
}
|
||
@@ -55,7 +53,6 @@ if (safe_browsing_mode == 1) {
|
||
"//base",
|
||
"//base:i18n",
|
||
"//components/safe_browsing/core:features",
|
||
- "//components/safe_browsing/core:file_type_policies",
|
||
"//third_party/unrar:unrar",
|
||
]
|
||
|
||
@@ -128,7 +125,7 @@ if (safe_browsing_mode == 1) {
|
||
}
|
||
|
||
source_set("safe_browsing") {
|
||
- deps = [ "//components/safe_browsing/core:file_type_policies" ]
|
||
+ deps = [ ]
|
||
|
||
if (safe_browsing_mode == 1) {
|
||
sources = [
|
||
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
|
||
--- a/chrome/renderer/chrome_content_renderer_client.cc
|
||
+++ b/chrome/renderer/chrome_content_renderer_client.cc
|
||
@@ -95,7 +95,9 @@
|
||
#include "components/paint_preview/buildflags/buildflags.h"
|
||
#include "components/pdf/renderer/pepper_pdf_host.h"
|
||
#include "components/safe_browsing/buildflags.h"
|
||
+#if defined(FULL_SAFE_BROWSING)
|
||
#include "components/safe_browsing/content/renderer/threat_dom_details.h"
|
||
+#endif
|
||
#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"
|
||
diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc
|
||
--- a/components/permissions/permission_request_manager.cc
|
||
+++ b/components/permissions/permission_request_manager.cc
|
||
@@ -67,6 +67,26 @@ constexpr char kAbusiveNotificationContentWarningMessage[] =
|
||
|
||
namespace {
|
||
|
||
+class NotificationPermissionUiSelectorBasedOnPrefs
|
||
+ : public NotificationPermissionUiSelector {
|
||
+ public:
|
||
+ explicit NotificationPermissionUiSelectorBasedOnPrefs()
|
||
+ {}
|
||
+ ~NotificationPermissionUiSelectorBasedOnPrefs() override = default;
|
||
+
|
||
+ // NotificationPermissionUiSelector:
|
||
+ void SelectUiToUse(permissions::PermissionRequest* request,
|
||
+ DecisionMadeCallback callback) override {
|
||
+ std::move(callback).Run(Decision::UseNormalUiAndShowNoWarning());
|
||
+ }
|
||
+
|
||
+ private:
|
||
+ NotificationPermissionUiSelectorBasedOnPrefs(
|
||
+ const NotificationPermissionUiSelectorBasedOnPrefs&) = delete;
|
||
+ const NotificationPermissionUiSelectorBasedOnPrefs& operator=(
|
||
+ NotificationPermissionUiSelectorBasedOnPrefs&) = delete;
|
||
+};
|
||
+
|
||
bool IsMessageTextEqual(PermissionRequest* a, PermissionRequest* b) {
|
||
if (a == b)
|
||
return true;
|
||
@@ -449,10 +469,10 @@ PermissionRequestManager::PermissionRequestManager(
|
||
view_(nullptr),
|
||
tab_is_hidden_(web_contents->GetVisibility() ==
|
||
content::Visibility::HIDDEN),
|
||
- auto_response_for_test_(NONE),
|
||
- notification_permission_ui_selectors_(
|
||
- PermissionsClient::Get()->CreateNotificationPermissionUiSelectors(
|
||
- web_contents->GetBrowserContext())) {}
|
||
+ auto_response_for_test_(NONE) {
|
||
+ notification_permission_ui_selectors_.emplace_back(
|
||
+ std::make_unique<NotificationPermissionUiSelectorBasedOnPrefs>());
|
||
+}
|
||
|
||
void PermissionRequestManager::ScheduleShowBubble() {
|
||
base::RecordAction(base::UserMetricsAction("PermissionBubbleRequest"));
|
||
diff --git a/components/safe_browsing/core/features.cc b/components/safe_browsing/core/features.cc
|
||
--- a/components/safe_browsing/core/features.cc
|
||
+++ b/components/safe_browsing/core/features.cc
|
||
@@ -139,7 +139,7 @@ const base::Feature kSafeBrowsingSectionUIAndroid{
|
||
"SafeBrowsingSecuritySectionUIAndroid", base::FEATURE_DISABLED_BY_DEFAULT};
|
||
|
||
const base::Feature kSuspiciousSiteTriggerQuotaFeature{
|
||
- "SafeBrowsingSuspiciousSiteTriggerQuota", base::FEATURE_ENABLED_BY_DEFAULT};
|
||
+ "SafeBrowsingSuspiciousSiteTriggerQuota", base::FEATURE_DISABLED_BY_DEFAULT};
|
||
|
||
const base::Feature kThreatDomDetailsTagAndAttributeFeature{
|
||
"ThreatDomDetailsTagAttributes", base::FEATURE_DISABLED_BY_DEFAULT};
|
||
diff --git a/components/safe_browsing/core/file_type_policies.cc b/components/safe_browsing/core/file_type_policies.cc
|
||
--- a/components/safe_browsing/core/file_type_policies.cc
|
||
+++ b/components/safe_browsing/core/file_type_policies.cc
|
||
@@ -49,8 +49,7 @@ FileTypePolicies::~FileTypePolicies() {
|
||
}
|
||
|
||
std::string FileTypePolicies::ReadResourceBundle() {
|
||
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
|
||
- return bundle.LoadDataResourceString(IDR_DOWNLOAD_FILE_TYPES_PB);
|
||
+ return nullptr;
|
||
}
|
||
|
||
void FileTypePolicies::RecordUpdateMetrics(UpdateResult result,
|
||
diff --git a/components/security_interstitials/content/captive_portal_blocking_page.cc b/components/security_interstitials/content/captive_portal_blocking_page.cc
|
||
--- a/components/security_interstitials/content/captive_portal_blocking_page.cc
|
||
+++ b/components/security_interstitials/content/captive_portal_blocking_page.cc
|
||
@@ -191,14 +191,9 @@ void CaptivePortalBlockingPage::PopulateInterstitialStrings(
|
||
load_time_data->SetString("recurrentErrorParagraph", "");
|
||
load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
|
||
|
||
- if (cert_report_helper()) {
|
||
- cert_report_helper()->PopulateExtendedReportingOption(load_time_data);
|
||
- cert_report_helper()->PopulateEnhancedProtectionMessage(load_time_data);
|
||
- } else {
|
||
load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox, false);
|
||
load_time_data->SetBoolean(
|
||
security_interstitials::kDisplayEnhancedProtectionMessage, false);
|
||
- }
|
||
}
|
||
|
||
void CaptivePortalBlockingPage::CommandReceived(const std::string& command) {
|
||
@@ -213,8 +208,6 @@ void CaptivePortalBlockingPage::CommandReceived(const std::string& command) {
|
||
security_interstitials::SecurityInterstitialCommand cmd =
|
||
static_cast<security_interstitials::SecurityInterstitialCommand>(
|
||
command_num);
|
||
- cert_report_helper()->HandleReportingCommands(cmd,
|
||
- controller()->GetPrefService());
|
||
switch (cmd) {
|
||
case security_interstitials::CMD_OPEN_LOGIN:
|
||
captive_portal::CaptivePortalMetrics::LogCaptivePortalBlockingPageEvent(
|
||
diff --git a/components/security_interstitials/content/cert_report_helper.cc b/components/security_interstitials/content/cert_report_helper.cc
|
||
--- a/components/security_interstitials/content/cert_report_helper.cc
|
||
+++ b/components/security_interstitials/content/cert_report_helper.cc
|
||
@@ -174,8 +174,6 @@ void CertReportHelper::FinishCertCollection() {
|
||
LOG(ERROR) << "Failed to serialize certificate report.";
|
||
return;
|
||
}
|
||
-
|
||
- ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report);
|
||
}
|
||
|
||
bool CertReportHelper::ShouldShowCertificateReporterCheckbox() {
|
||
diff --git a/components/unified_consent/unified_consent_service.cc b/components/unified_consent/unified_consent_service.cc
|
||
--- a/components/unified_consent/unified_consent_service.cc
|
||
+++ b/components/unified_consent/unified_consent_service.cc
|
||
@@ -57,7 +57,7 @@ void UnifiedConsentService::SetUrlKeyedAnonymizedDataCollectionEnabled(
|
||
SetMigrationState(MigrationState::kCompleted);
|
||
|
||
pref_service_->SetBoolean(prefs::kUrlKeyedAnonymizedDataCollectionEnabled,
|
||
- enabled);
|
||
+ false);
|
||
}
|
||
|
||
void UnifiedConsentService::Shutdown() {
|
||
diff --git a/content/browser/file_system_access/native_file_system_file_writer_impl.cc b/content/browser/file_system_access/native_file_system_file_writer_impl.cc
|
||
--- a/content/browser/file_system_access/native_file_system_file_writer_impl.cc
|
||
+++ b/content/browser/file_system_access/native_file_system_file_writer_impl.cc
|
||
@@ -145,8 +145,7 @@ NativeFileSystemFileWriterImpl::NativeFileSystemFileWriterImpl(
|
||
: NativeFileSystemHandleBase(manager, context, url, handle_state),
|
||
swap_url_(swap_url),
|
||
quarantine_connection_callback_(
|
||
- std::move(quarantine_connection_callback)),
|
||
- has_transient_user_activation_(has_transient_user_activation) {
|
||
+ std::move(quarantine_connection_callback)) {
|
||
DCHECK_EQ(swap_url.type(), url.type());
|
||
}
|
||
|
||
@@ -461,52 +460,7 @@ void NativeFileSystemFileWriterImpl::CloseImpl(CloseCallback callback) {
|
||
// If the after write check fails, the callback for that will clean up the
|
||
// swap file even if the writer was destroyed at that point.
|
||
state_ = State::kClosePending;
|
||
-
|
||
- if (!RequireSecurityChecks() || !manager()->permission_context()) {
|
||
- DidPassAfterWriteCheck(std::move(callback));
|
||
- return;
|
||
- }
|
||
-
|
||
- ComputeHashForSwapFile(base::BindOnce(
|
||
- &NativeFileSystemFileWriterImpl::DoAfterWriteCheck,
|
||
- weak_factory_.GetWeakPtr(), base::WrapRefCounted(manager()), swap_url(),
|
||
- std::move(callback)));
|
||
-}
|
||
-
|
||
-// static
|
||
-void NativeFileSystemFileWriterImpl::DoAfterWriteCheck(
|
||
- base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
|
||
- scoped_refptr<NativeFileSystemManagerImpl> manager,
|
||
- const storage::FileSystemURL& swap_url,
|
||
- NativeFileSystemFileWriterImpl::CloseCallback callback,
|
||
- base::File::Error hash_result,
|
||
- const std::string& hash,
|
||
- int64_t size) {
|
||
- if (!file_writer || hash_result != base::File::FILE_OK) {
|
||
- // If writer was deleted, or calculating the hash failed try deleting the
|
||
- // swap file and invoke the callback.
|
||
- manager->operation_runner().PostTaskWithThisObject(
|
||
- FROM_HERE, base::BindOnce(&RemoveSwapFile, swap_url));
|
||
- std::move(callback).Run(native_file_system_error::FromStatus(
|
||
- NativeFileSystemStatus::kOperationAborted,
|
||
- "Failed to perform Safe Browsing check."));
|
||
- return;
|
||
- }
|
||
-
|
||
- DCHECK_CALLED_ON_VALID_SEQUENCE(file_writer->sequence_checker_);
|
||
-
|
||
- auto item = std::make_unique<NativeFileSystemWriteItem>();
|
||
- item->target_file_path = file_writer->url().path();
|
||
- item->full_path = file_writer->swap_url().path();
|
||
- item->sha256_hash = hash;
|
||
- item->size = size;
|
||
- item->frame_url = file_writer->context().url;
|
||
- item->has_user_gesture = file_writer->has_transient_user_activation_;
|
||
- file_writer->manager()->permission_context()->PerformAfterWriteChecks(
|
||
- std::move(item), file_writer->context().frame_id,
|
||
- base::BindOnce(&NativeFileSystemFileWriterImpl::DidAfterWriteCheck,
|
||
- file_writer, std::move(manager), swap_url,
|
||
- std::move(callback)));
|
||
+ DidPassAfterWriteCheck(std::move(callback));
|
||
}
|
||
|
||
// static
|
||
diff --git a/content/browser/file_system_access/native_file_system_file_writer_impl.h b/content/browser/file_system_access/native_file_system_file_writer_impl.h
|
||
--- a/content/browser/file_system_access/native_file_system_file_writer_impl.h
|
||
+++ b/content/browser/file_system_access/native_file_system_file_writer_impl.h
|
||
@@ -83,14 +83,6 @@ class CONTENT_EXPORT NativeFileSystemFileWriterImpl
|
||
void CloseImpl(CloseCallback callback);
|
||
// The following two methods are static, because they need to be invoked to
|
||
// perform cleanup even if the writer was deleted before they were invoked.
|
||
- static void DoAfterWriteCheck(
|
||
- base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
|
||
- scoped_refptr<NativeFileSystemManagerImpl> manager,
|
||
- const storage::FileSystemURL& swap_url,
|
||
- NativeFileSystemFileWriterImpl::CloseCallback callback,
|
||
- base::File::Error hash_result,
|
||
- const std::string& hash,
|
||
- int64_t size);
|
||
static void DidAfterWriteCheck(
|
||
base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
|
||
scoped_refptr<NativeFileSystemManagerImpl> manager,
|
||
@@ -116,7 +108,7 @@ class CONTENT_EXPORT NativeFileSystemFileWriterImpl
|
||
// except temporary file systems.
|
||
// TOOD(crbug.com/1103076): Extend this check to non-native paths.
|
||
bool RequireSecurityChecks() const {
|
||
- return url().type() != storage::kFileSystemTypeTemporary;
|
||
+ return false;
|
||
}
|
||
|
||
void ComputeHashForSwapFile(HashCallback callback);
|
||
@@ -150,10 +142,6 @@ class CONTENT_EXPORT NativeFileSystemFileWriterImpl
|
||
|
||
download::QuarantineConnectionCallback quarantine_connection_callback_;
|
||
|
||
- // Keeps track of user activation state at creation time for after write
|
||
- // checks.
|
||
- bool has_transient_user_activation_ = false;
|
||
-
|
||
base::WeakPtr<NativeFileSystemHandleBase> AsWeakPtr() override;
|
||
|
||
base::WeakPtrFactory<NativeFileSystemFileWriterImpl> weak_factory_{this};
|
||
diff --git a/content/public/browser/native_file_system_permission_context.h b/content/public/browser/native_file_system_permission_context.h
|
||
--- a/content/public/browser/native_file_system_permission_context.h
|
||
+++ b/content/public/browser/native_file_system_permission_context.h
|
||
@@ -99,12 +99,6 @@ class NativeFileSystemPermissionContext {
|
||
base::OnceCallback<void(SensitiveDirectoryResult)> callback) = 0;
|
||
|
||
enum class AfterWriteCheckResult { kAllow, kBlock };
|
||
- // Runs a recently finished write operation through checks such as malware
|
||
- // or other security checks to determine if the write should be allowed.
|
||
- virtual void PerformAfterWriteChecks(
|
||
- std::unique_ptr<NativeFileSystemWriteItem> item,
|
||
- GlobalFrameRoutingId frame_id,
|
||
- base::OnceCallback<void(AfterWriteCheckResult)> callback) = 0;
|
||
|
||
// Returns whether the give |origin| already allows read permission, or it is
|
||
// possible to request one. This is used to block file dialogs from being
|
||
--
|
||
2.17.1
|
||
|