252 lines
12 KiB
Diff
252 lines
12 KiB
Diff
From: uazo <uazo@users.noreply.github.com>
|
|
Date: Sat, 13 Nov 2021 09:17:06 +0000
|
|
Subject: Disable FLoC and privacy sandbox
|
|
|
|
Remove UI from the settings and set the flags to inactive
|
|
Permanently removes FLoC support, disabling the download of LSH clusters,
|
|
the marking the history navigation and the javascript API and permission policies.
|
|
Also added the disabling of blink features through the DisabledForBromite tag
|
|
|
|
Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
|
---
|
|
.../java/res/xml/privacy_preferences.xml | 4 ---
|
|
.../privacy/settings/PrivacySettings.java | 23 ------------
|
|
.../browser/chrome_content_browser_client.cc | 3 ++
|
|
.../history/core/browser/history_backend.cc | 13 +------
|
|
.../privacy_sandbox/privacy_sandbox_prefs.cc | 2 +-
|
|
.../privacy_sandbox_settings.cc | 35 +++++++++++--------
|
|
.../privacy_sandbox_settings.h | 1 -
|
|
7 files changed, 25 insertions(+), 56 deletions(-)
|
|
|
|
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
|
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
|
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
|
@@ -68,10 +68,6 @@ found in the LICENSE file.
|
|
android:title="@string/open_external_links_incognito_title"
|
|
android:summary="@string/open_external_links_incognito_summary"
|
|
android:defaultValue="false" />
|
|
- <Preference
|
|
- android:key="privacy_sandbox"
|
|
- android:title="@string/prefs_privacy_sandbox"
|
|
- android:fragment="org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxSettingsFragment"/>
|
|
<PreferenceCategory
|
|
android:key="services_category"
|
|
android:title="@string/services_category_title">
|
|
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
|
|
@@ -58,8 +58,6 @@ public class PrivacySettings
|
|
private static final String PREF_SECURE_DNS = "secure_dns";
|
|
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
|
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
|
- private static final String PREF_PRIVACY_SANDBOX = "privacy_sandbox";
|
|
- private static final String PREF_PROXY_OPTIONS = "proxy";
|
|
private static final String PREF_PRIVACY_GUIDE = "privacy_guide";
|
|
private static final String PREF_INCOGNITO_LOCK = "incognito_lock";
|
|
|
|
@@ -86,21 +84,6 @@ public class PrivacySettings
|
|
SettingsUtils.addPreferencesFromResource(this, R.xml.privacy_preferences);
|
|
getActivity().setTitle(R.string.prefs_privacy_security);
|
|
|
|
- Preference sandboxPreference = findPreference(PREF_PRIVACY_SANDBOX);
|
|
- // Hide the Privacy Sandbox if it is restricted.
|
|
- if (PrivacySandboxBridge.isPrivacySandboxRestricted()) {
|
|
- getPreferenceScreen().removePreference(sandboxPreference);
|
|
- } else {
|
|
- sandboxPreference.setSummary(
|
|
- PrivacySandboxSettingsFragment.getStatusString(getContext()));
|
|
- // Overwrite the click listener to pass a correct referrer to the fragment.
|
|
- sandboxPreference.setOnPreferenceClickListener(preference -> {
|
|
- PrivacySandboxSettingsFragmentV3.launchPrivacySandboxSettings(getContext(),
|
|
- new SettingsLauncherImpl(), PrivacySandboxReferrer.PRIVACY_SETTINGS);
|
|
- return true;
|
|
- });
|
|
- }
|
|
-
|
|
Preference privacyGuidePreference = findPreference(PREF_PRIVACY_GUIDE);
|
|
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.PRIVACY_GUIDE)) {
|
|
getPreferenceScreen().removePreference(privacyGuidePreference);
|
|
@@ -220,12 +203,6 @@ public class PrivacySettings
|
|
secureDnsPref.setSummary(SecureDnsSettings.getSummary(getContext()));
|
|
}
|
|
|
|
- Preference privacySandboxPreference = findPreference(PREF_PRIVACY_SANDBOX);
|
|
- if (privacySandboxPreference != null) {
|
|
- privacySandboxPreference.setSummary(
|
|
- PrivacySandboxSettingsFragment.getStatusString(getContext()));
|
|
- }
|
|
-
|
|
mIncognitoLockSettings.updateIncognitoReauthPreferenceIfNeeded(getActivity());
|
|
}
|
|
|
|
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
|
|
@@ -3091,6 +3091,9 @@ bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
|
|
const url::Origin* source_origin,
|
|
const url::Origin* destination_origin,
|
|
const url::Origin* reporting_origin) {
|
|
+ // make sure that this is always disabled in Bromite even if privacy sandbox is already disabled in the prefs
|
|
+ if ((true))
|
|
+ return false;
|
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
|
|
|
auto* privacy_sandbox_settings =
|
|
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
|
|
--- a/components/history/core/browser/history_backend.cc
|
|
+++ b/components/history/core/browser/history_backend.cc
|
|
@@ -495,18 +495,7 @@ void HistoryBackend::SetBrowsingTopicsAllowed(ContextID context_id,
|
|
if (!visit_id)
|
|
return;
|
|
|
|
- // Only add to the annotations table if the visit_id exists in the visits
|
|
- // table.
|
|
- VisitContentAnnotations annotations;
|
|
- if (db_->GetContentAnnotationsForVisit(visit_id, &annotations)) {
|
|
- annotations.annotation_flags |=
|
|
- VisitContentAnnotationFlag::kBrowsingTopicsEligible;
|
|
- db_->UpdateContentAnnotationsForVisit(visit_id, annotations);
|
|
- } else {
|
|
- annotations.annotation_flags |=
|
|
- VisitContentAnnotationFlag::kBrowsingTopicsEligible;
|
|
- db_->AddContentAnnotationsForVisit(visit_id, annotations);
|
|
- }
|
|
+ // in Bromite disallow marking anything in history related to topics
|
|
ScheduleCommit();
|
|
}
|
|
|
|
diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.cc b/components/privacy_sandbox/privacy_sandbox_prefs.cc
|
|
--- a/components/privacy_sandbox/privacy_sandbox_prefs.cc
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_prefs.cc
|
|
@@ -66,7 +66,7 @@ namespace privacy_sandbox {
|
|
|
|
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
|
|
registry->RegisterBooleanPref(
|
|
- prefs::kPrivacySandboxApisEnabled, true,
|
|
+ prefs::kPrivacySandboxApisEnabled, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterBooleanPref(prefs::kPrivacySandboxApisEnabledV2, false);
|
|
registry->RegisterBooleanPref(
|
|
diff --git a/components/privacy_sandbox/privacy_sandbox_settings.cc b/components/privacy_sandbox/privacy_sandbox_settings.cc
|
|
--- a/components/privacy_sandbox/privacy_sandbox_settings.cc
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_settings.cc
|
|
@@ -68,8 +68,7 @@ PrivacySandboxSettings::PrivacySandboxSettings(
|
|
: delegate_(std::move(delegate)),
|
|
host_content_settings_map_(host_content_settings_map),
|
|
cookie_settings_(cookie_settings),
|
|
- pref_service_(pref_service),
|
|
- incognito_profile_(incognito_profile) {
|
|
+ pref_service_(pref_service) {
|
|
DCHECK(pref_service_);
|
|
DCHECK(host_content_settings_map_);
|
|
DCHECK(cookie_settings_);
|
|
@@ -94,7 +93,8 @@ PrivacySandboxSettings::PrivacySandboxSettings(
|
|
|
|
PrivacySandboxSettings::~PrivacySandboxSettings() = default;
|
|
|
|
-bool PrivacySandboxSettings::IsTopicsAllowed() const {
|
|
+bool PrivacySandboxSettings::IsTopicsAllowed() const { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
// Topics API calculation should be prevented if the user has blocked 3PC
|
|
// cookies, as there will be no context specific check.
|
|
const auto cookie_controls_mode =
|
|
@@ -119,7 +119,8 @@ bool PrivacySandboxSettings::IsTopicsAllowedForContext(
|
|
IsPrivacySandboxEnabledForContext(url, top_frame_origin);
|
|
}
|
|
|
|
-bool PrivacySandboxSettings::IsTopicAllowed(const CanonicalTopic& topic) {
|
|
+bool PrivacySandboxSettings::IsTopicAllowed(const CanonicalTopic& topic) { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
const auto& blocked_topics =
|
|
pref_service_->GetList(prefs::kPrivacySandboxBlockedTopics);
|
|
|
|
@@ -187,9 +188,8 @@ base::Time PrivacySandboxSettings::TopicsDataAccessibleSince() const {
|
|
|
|
bool PrivacySandboxSettings::IsAttributionReportingAllowed(
|
|
const url::Origin& top_frame_origin,
|
|
- const url::Origin& reporting_origin) const {
|
|
- return IsPrivacySandboxEnabledForContext(reporting_origin.GetURL(),
|
|
- top_frame_origin);
|
|
+ const url::Origin& reporting_origin) const { // disabled in Bromite
|
|
+ return false;
|
|
}
|
|
|
|
bool PrivacySandboxSettings::MaySendAttributionReport(
|
|
@@ -278,7 +278,8 @@ void PrivacySandboxSettings::ClearFledgeJoiningAllowedSettings(
|
|
}
|
|
|
|
bool PrivacySandboxSettings::IsFledgeJoiningAllowed(
|
|
- const url::Origin& top_frame_origin) const {
|
|
+ const url::Origin& top_frame_origin) const { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
ScopedDictPrefUpdate scoped_pref_update(
|
|
pref_service_, prefs::kPrivacySandboxFledgeJoinBlocked);
|
|
auto& pref_data = scoped_pref_update.Get();
|
|
@@ -334,7 +335,9 @@ bool PrivacySandboxSettings::IsPrivateAggregationAllowed(
|
|
top_frame_origin);
|
|
}
|
|
|
|
-bool PrivacySandboxSettings::IsPrivacySandboxEnabled() const {
|
|
+bool PrivacySandboxSettings::IsPrivacySandboxEnabled() const { // disabled in Bromite
|
|
+ if ((true))
|
|
+ return false;
|
|
// If the delegate is restricting access the Privacy Sandbox is disabled.
|
|
if (delegate_->IsPrivacySandboxRestricted())
|
|
return false;
|
|
@@ -349,7 +352,7 @@ bool PrivacySandboxSettings::IsPrivacySandboxEnabled() const {
|
|
// settings is available.
|
|
if (base::FeatureList::IsEnabled(privacy_sandbox::kPrivacySandboxSettings3)) {
|
|
// For Privacy Sandbox Settings 3, APIs are disabled in incognito.
|
|
- if (incognito_profile_)
|
|
+ if ((true))
|
|
return false;
|
|
|
|
if (should_override_setting_for_local_testing) {
|
|
@@ -367,7 +370,8 @@ bool PrivacySandboxSettings::IsPrivacySandboxEnabled() const {
|
|
return pref_service_->GetBoolean(prefs::kPrivacySandboxApisEnabled);
|
|
}
|
|
|
|
-void PrivacySandboxSettings::SetPrivacySandboxEnabled(bool enabled) {
|
|
+void PrivacySandboxSettings::SetPrivacySandboxEnabled(bool enabled) { // disabled in Bromite
|
|
+ enabled = false;
|
|
// Only apply the decision to the appropriate preference.
|
|
if (base::FeatureList::IsEnabled(privacy_sandbox::kPrivacySandboxSettings3)) {
|
|
pref_service_->SetBoolean(prefs::kPrivacySandboxApisEnabledV2, enabled);
|
|
@@ -376,7 +380,8 @@ void PrivacySandboxSettings::SetPrivacySandboxEnabled(bool enabled) {
|
|
}
|
|
}
|
|
|
|
-bool PrivacySandboxSettings::IsTrustTokensAllowed() {
|
|
+bool PrivacySandboxSettings::IsTrustTokensAllowed() { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
// The PrivacySandboxSettings is only involved in Trust Token access
|
|
// decisions when the Release 3 flag is enabled.
|
|
if (!base::FeatureList::IsEnabled(privacy_sandbox::kPrivacySandboxSettings3))
|
|
@@ -441,9 +446,9 @@ bool PrivacySandboxSettings::IsPrivacySandboxEnabledForContext(
|
|
content_settings::CookieSettings::QueryReason::kPrivacySandbox);
|
|
}
|
|
|
|
-void PrivacySandboxSettings::SetTopicsDataAccessibleFromNow() const {
|
|
- pref_service_->SetTime(prefs::kPrivacySandboxTopicsDataAccessibleSince,
|
|
- base::Time::Now());
|
|
+void PrivacySandboxSettings::SetTopicsDataAccessibleFromNow() const { // disabled in Bromite
|
|
+ pref_service_->ClearPref(prefs::kPrivacySandboxTopicsDataAccessibleSince);
|
|
+ if ((true)) return;
|
|
|
|
for (auto& observer : observers_)
|
|
observer.OnTopicsDataAccessibleSinceUpdated();
|
|
diff --git a/components/privacy_sandbox/privacy_sandbox_settings.h b/components/privacy_sandbox/privacy_sandbox_settings.h
|
|
--- a/components/privacy_sandbox/privacy_sandbox_settings.h
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_settings.h
|
|
@@ -227,7 +227,6 @@ class PrivacySandboxSettings : public KeyedService {
|
|
scoped_refptr<content_settings::CookieSettings> cookie_settings_;
|
|
raw_ptr<PrefService> pref_service_;
|
|
PrefChangeRegistrar pref_change_registrar_;
|
|
- bool incognito_profile_;
|
|
};
|
|
|
|
} // namespace privacy_sandbox
|
|
--
|
|
2.25.1
|