Commit 73240199 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Remove state variables from FourStateCookieSettingsPreference

The preference only needs to know which radio button is selected
to determine its state. Removing the variables avoids inconsistencies.
The values used for initialization are moved into a class to avoid a
large number of boolean parameters.

Change-Id: I1cde64d6c14c396b2997aafdcbaf26a49453b25d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2139727
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarEhimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758881}
parent e7ea3e9e
......@@ -1034,11 +1034,18 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
private void configureFourStateCookieToggle(
FourStateCookieSettingsPreference fourStateCookieToggle) {
fourStateCookieToggle.setOnPreferenceChangeListener(this);
fourStateCookieToggle.setState(mCategory.isManaged(),
PrefServiceBridge.getInstance().isManagedPreference(Pref.BLOCK_THIRD_PARTY_COOKIES),
WebsitePreferenceBridge.isCategoryEnabled(ContentSettingsType.COOKIES),
PrefServiceBridge.getInstance().getBoolean(Pref.BLOCK_THIRD_PARTY_COOKIES),
PrefServiceBridge.getInstance().getInteger(Pref.COOKIE_CONTROLS_MODE));
FourStateCookieSettingsPreference.Params params =
new FourStateCookieSettingsPreference.Params();
params.allowCookies =
WebsitePreferenceBridge.isCategoryEnabled(ContentSettingsType.COOKIES);
params.blockThirdPartyCookies =
PrefServiceBridge.getInstance().getBoolean(Pref.BLOCK_THIRD_PARTY_COOKIES);
params.cookieControlsMode =
PrefServiceBridge.getInstance().getInteger(Pref.COOKIE_CONTROLS_MODE);
params.cookiesContentSettingEnforced = mCategory.isManaged();
params.thirdPartyBlockingEnforced =
PrefServiceBridge.getInstance().isManagedPreference(Pref.BLOCK_THIRD_PARTY_COOKIES);
fourStateCookieToggle.setState(params);
}
private void configureTriStateToggle(
......
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