Commit 9d12723a authored by Stephen Nusko's avatar Stephen Nusko Committed by Commit Bot

Revert "Reland "Remove BlockThirdPartyCookies preference""

This reverts commit e8bb886c.

Reason for revert: Still breaks perf bots: crbug/1124326

Original change's description:
> Reland "Remove BlockThirdPartyCookies preference"
> 
> This is a reland of 1180542b
> 
> BLOCK_THIRD_PARTY_COOKIES usage in clank is fixed:
> https://crrev.com/i/3250184
> 
> Original change's description:
> > Remove BlockThirdPartyCookies preference
> >
> > The boolean BlockThirdPartyCookies preference was replaced by
> > CookieControlsMode enum. Existing settings were migrated since M83.
> > Since all usage of the preference has been removed, the preference
> > can be removed and existing settings cleared.
> >
> > Bug: 1104836
> > Change-Id: Ie6e38b0a424981395c627459d684030ea84a58b7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2387805
> > Reviewed-by: Balazs Engedy <engedy@chromium.org>
> > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > Commit-Queue: Christian Dullweber <dullweber@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#803844}
> 
> Tbr: gab@chromium.org
> Bug: 1104836
> Change-Id: If89041daa0a46da604171acf734b9733d9a24e07
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390655
> Commit-Queue: Christian Dullweber <dullweber@chromium.org>
> Reviewed-by: Balazs Engedy <engedy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#804217}

TBR=gab@chromium.org,engedy@chromium.org,dullweber@chromium.org

Change-Id: I2a6799c01373c1b5b265fa2518406a2305e1dbd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1104836,1124326
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390912Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804224}
parent 2f487fe5
......@@ -567,9 +567,6 @@ const char kHashedAvailablePages[] = "previews.offline_helper.available_pages";
// Deprecated 7/2020
const char kObservedSessionTime[] = "profile.observed_session_time";
// Deprecated 9/2020
const char kBlockThirdPartyCookies[] = "profile.block_third_party_cookies";
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
......@@ -678,8 +675,6 @@ void RegisterProfilePrefsForMigration(
registry->RegisterDictionaryPref(kHashedAvailablePages);
registry->RegisterDictionaryPref(kObservedSessionTime);
registry->RegisterBooleanPref(kBlockThirdPartyCookies, false);
}
} // namespace
......@@ -1346,7 +1341,4 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
// Added 7/2020
profile_prefs->ClearPref(kObservedSessionTime);
// Added 9/2020
profile_prefs->ClearPref(kBlockThirdPartyCookies);
}
......@@ -60,6 +60,9 @@ void CookieSettings::GetCookieSettings(
void CookieSettings::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(
prefs::kBlockThirdPartyCookies, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kCookieControlsMode,
static_cast<int>(CookieControlsMode::kIncognitoOnly),
......@@ -237,9 +240,7 @@ void CookieSettings::GetCookieSettingInternal(
CookieSettings::~CookieSettings() = default;
bool CookieSettings::ShouldBlockThirdPartyCookiesInternal() {
DCHECK(thread_checker_.CalledOnValidThread());
bool CookieSettings::IsCookieControlsEnabled() {
#if defined(OS_IOS)
if (!base::FeatureList::IsEnabled(kImprovedCookieControls))
return false;
......@@ -273,7 +274,8 @@ void CookieSettings::OnContentSettingChanged(
void CookieSettings::OnCookiePreferencesChanged() {
DCHECK(thread_checker_.CalledOnValidThread());
bool new_block_third_party_cookies = ShouldBlockThirdPartyCookiesInternal();
bool new_block_third_party_cookies =
IsCookieControlsEnabled();
// Safe to read |block_third_party_cookies_| without locking here because the
// only place that writes to it is this method and it will always be run on
......
......@@ -140,6 +140,9 @@ class CookieSettings : public CookieSettingsBase,
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
// Returns true when the improved cookie control UI should be shown.
// TODO(dullweber): Fix grammar.
bool IsCookieControlsEnabled();
private:
~CookieSettings() override;
......@@ -170,10 +173,6 @@ class CookieSettings : public CookieSettingsBase,
void OnCookiePreferencesChanged();
// Evaluate if third-party cookies are blocked. Should only be called
// when the preference changes to update the internal state.
bool ShouldBlockThirdPartyCookiesInternal();
base::ThreadChecker thread_checker_;
base::ObserverList<Observer> observers_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
......
......@@ -6,6 +6,10 @@
namespace prefs {
// Boolean that is true if we should unconditionally block third-party cookies,
// regardless of other content settings.
const char kBlockThirdPartyCookies[] = "profile.block_third_party_cookies";
// CookieControlsMode enum value that decides when the cookie controls UI is
// enabled. This will block third-party cookies similar to
// kBlockThirdPartyCookies but with a new UI.
......
......@@ -13,6 +13,9 @@ namespace prefs {
// some of these are generated by WebsiteSettingsInfo from content settings
// names.
// TODO(crbug.com/967668): Remove direct access to these preferences and
// replace with CookieSettings::ShouldBlockThirdPartyCookies().
extern const char kBlockThirdPartyCookies[];
extern const char kCookieControlsMode[];
extern const char kContentSettingsVersion[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment