223 lines
11 KiB
Diff
223 lines
11 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.
|
|
|
|
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
|
|
---
|
|
.../browser/chrome_content_browser_client.cc | 3 +++
|
|
.../privacy_sandbox_settings_delegate.cc | 1 +
|
|
.../privacy_sandbox/privacy_sandbox_prompt.cc | 1 +
|
|
.../history/core/browser/history_backend.cc | 13 +------------
|
|
.../privacy_sandbox_attestations.cc | 2 --
|
|
.../privacy_sandbox_features.cc | 4 ++++
|
|
.../privacy_sandbox/privacy_sandbox_prefs.cc | 4 ++--
|
|
.../privacy_sandbox_settings_impl.cc | 19 ++++++++++++++-----
|
|
.../Disable-FLoC-and-privacy-sandbox.inc | 1 +
|
|
third_party/blink/common/features.cc | 1 +
|
|
10 files changed, 28 insertions(+), 21 deletions(-)
|
|
create mode 100644 cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc
|
|
|
|
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
|
|
@@ -3239,6 +3239,9 @@ bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
|
|
const url::Origin* destination_origin,
|
|
const url::Origin* reporting_origin,
|
|
bool* can_bypass) {
|
|
+ // 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/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc
|
|
--- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc
|
|
+++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc
|
|
@@ -159,6 +159,7 @@ bool PrivacySandboxSettingsDelegate::HasAppropriateTopicsConsent() const {
|
|
|
|
bool PrivacySandboxSettingsDelegate::PrivacySandboxRestrictedNoticeRequired()
|
|
const {
|
|
+ if ((true)) return true;
|
|
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_);
|
|
|
|
if (!identity_manager ||
|
|
diff --git a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt.cc b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt.cc
|
|
--- a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt.cc
|
|
+++ b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt.cc
|
|
@@ -8,5 +8,6 @@
|
|
|
|
void ShowPrivacySandboxPrompt(Browser* browser,
|
|
PrivacySandboxService::PromptType prompt_type) {
|
|
+ if ((true)) return;
|
|
ShowPrivacySandboxDialog(browser, prompt_type);
|
|
}
|
|
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
|
|
@@ -656,18 +656,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_attestations/privacy_sandbox_attestations.cc b/components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.cc
|
|
--- a/components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.cc
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.cc
|
|
@@ -478,8 +478,6 @@ void PrivacySandboxAttestations::OnAttestationsParsed(
|
|
if (attestations_map.has_value() &&
|
|
(!file_version_.IsValid() || file_version_.CompareTo(version) < 0)) {
|
|
// Parsing succeeded and the attestations file has newer version.
|
|
- file_version_ = std::move(version);
|
|
- attestations_map_ = std::move(attestations_map.value());
|
|
}
|
|
|
|
attestations_parse_progress_ = Progress::kFinished;
|
|
diff --git a/components/privacy_sandbox/privacy_sandbox_features.cc b/components/privacy_sandbox/privacy_sandbox_features.cc
|
|
--- a/components/privacy_sandbox/privacy_sandbox_features.cc
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_features.cc
|
|
@@ -167,4 +167,8 @@ BASE_FEATURE(kTrackingProtectionNoticeRequestTracking,
|
|
base::FEATURE_DISABLED_BY_DEFAULT);
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
|
|
+SET_CROMITE_FEATURE_DISABLED(kPrivacySandboxSettings4);
|
|
+SET_CROMITE_FEATURE_ENABLED(kDisablePrivacySandboxPrompts);
|
|
+SET_CROMITE_FEATURE_DISABLED(kEnforcePrivacySandboxAttestations);
|
|
+SET_CROMITE_FEATURE_DISABLED(kPrivacySandboxFirstPartySetsUI);
|
|
} // namespace privacy_sandbox
|
|
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
|
|
@@ -12,7 +12,7 @@ namespace privacy_sandbox {
|
|
|
|
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
|
|
registry->RegisterBooleanPref(
|
|
- prefs::kPrivacySandboxApisEnabled, true,
|
|
+ prefs::kPrivacySandboxApisEnabled, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterBooleanPref(prefs::kPrivacySandboxM1ConsentDecisionMade,
|
|
false);
|
|
@@ -27,7 +27,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
|
|
registry->RegisterBooleanPref(prefs::kPrivacySandboxM1FledgeEnabled, false);
|
|
registry->RegisterBooleanPref(prefs::kPrivacySandboxM1AdMeasurementEnabled,
|
|
false);
|
|
- registry->RegisterBooleanPref(prefs::kPrivacySandboxM1Restricted, false);
|
|
+ registry->RegisterBooleanPref(prefs::kPrivacySandboxM1Restricted, true);
|
|
|
|
registry->RegisterTimePref(prefs::kPrivacySandboxTopicsDataAccessibleSince,
|
|
base::Time());
|
|
diff --git a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc
|
|
--- a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc
|
|
+++ b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc
|
|
@@ -123,7 +123,7 @@ std::set<browsing_topics::Topic> GetTopicsSetFromString(
|
|
|
|
// static
|
|
bool PrivacySandboxSettingsImpl::IsAllowed(Status status) {
|
|
- return status == Status::kAllowed;
|
|
+ return false;
|
|
}
|
|
|
|
// static
|
|
@@ -232,7 +232,8 @@ PrivacySandboxSettingsImpl::GetFinchPrioritizedTopics() {
|
|
return finch_prioritized_topics_;
|
|
}
|
|
|
|
-bool PrivacySandboxSettingsImpl::IsTopicsAllowed() const {
|
|
+bool PrivacySandboxSettingsImpl::IsTopicsAllowed() const { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
Status status = GetM1TopicAllowedStatus();
|
|
JoinHistogram(kIsTopicsAllowedHistogram, status);
|
|
return IsAllowed(status);
|
|
@@ -264,7 +265,8 @@ bool PrivacySandboxSettingsImpl::IsTopicsAllowedForContext(
|
|
return IsAllowed(status);
|
|
}
|
|
|
|
-bool PrivacySandboxSettingsImpl::IsTopicAllowed(const CanonicalTopic& topic) {
|
|
+bool PrivacySandboxSettingsImpl::IsTopicAllowed(const CanonicalTopic& topic) { // disabled in Bromite
|
|
+ if ((true)) return false;
|
|
const auto& blocked_topics =
|
|
pref_service_->GetList(prefs::kPrivacySandboxBlockedTopics);
|
|
|
|
@@ -466,6 +468,7 @@ bool PrivacySandboxSettingsImpl::
|
|
void PrivacySandboxSettingsImpl::SetFledgeJoiningAllowed(
|
|
const std::string& top_frame_etld_plus1,
|
|
bool allowed) {
|
|
+ if ((true)) return;
|
|
ScopedDictPrefUpdate scoped_pref_update(
|
|
pref_service_, prefs::kPrivacySandboxFledgeJoinBlocked);
|
|
|
|
@@ -536,7 +539,8 @@ void PrivacySandboxSettingsImpl::ClearFledgeJoiningAllowedSettings(
|
|
}
|
|
|
|
bool PrivacySandboxSettingsImpl::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();
|
|
@@ -782,7 +786,10 @@ void PrivacySandboxSettingsImpl::SetDelegateForTesting(
|
|
delegate_ = std::move(delegate);
|
|
}
|
|
|
|
-void PrivacySandboxSettingsImpl::SetTopicsDataAccessibleFromNow() const {
|
|
+void PrivacySandboxSettingsImpl::SetTopicsDataAccessibleFromNow() const { // disabled in Bromite
|
|
+ pref_service_->ClearPref(prefs::kPrivacySandboxTopicsDataAccessibleSince);
|
|
+ if ((true)) return;
|
|
+
|
|
pref_service_->SetTime(prefs::kPrivacySandboxTopicsDataAccessibleSince,
|
|
base::Time::Now());
|
|
|
|
@@ -795,6 +802,7 @@ PrivacySandboxSettingsImpl::Status
|
|
PrivacySandboxSettingsImpl::GetSiteAccessAllowedStatus(
|
|
const url::Origin& top_frame_origin,
|
|
const GURL& url) const {
|
|
+ if ((true)) return Status::kSiteDataAccessBlocked;
|
|
// Relying on |host_content_settings_map_| instead of |cookie_settings_|
|
|
// allows to query whether the site associated with the |url| is allowed to
|
|
// access Site data (aka ContentSettingsType::COOKIES) without considering any
|
|
@@ -809,6 +817,7 @@ PrivacySandboxSettingsImpl::GetSiteAccessAllowedStatus(
|
|
PrivacySandboxSettingsImpl::Status
|
|
PrivacySandboxSettingsImpl::GetPrivacySandboxAllowedStatus(
|
|
bool should_ignore_restriction /*=false*/) const {
|
|
+ if ((true)) return Status::kRestricted;
|
|
if (delegate_->IsIncognitoProfile()) {
|
|
return Status::kIncognitoProfile;
|
|
}
|
|
diff --git a/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc b/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/cromite_flags/third_party/blink/common/features_cc/Disable-FLoC-and-privacy-sandbox.inc
|
|
@@ -0,0 +1 @@
|
|
+SET_CROMITE_FEATURE_DISABLED(kFencedFrames);
|
|
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
|
|
--- a/third_party/blink/common/features.cc
|
|
+++ b/third_party/blink/common/features.cc
|
|
@@ -2462,6 +2462,7 @@ bool IsAllowPageWithIDBConnectionAndTransactionInBFCacheEnabled() {
|
|
}
|
|
|
|
bool IsAllowURNsInIframeEnabled() {
|
|
+ if ((true)) return false; // see https://chromium-review.googlesource.com/c/chromium/src/+/3690741
|
|
return base::FeatureList::IsEnabled(blink::features::kAllowURNsInIframes);
|
|
}
|
|
|
|
--
|