use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.
the class SavePasswordsPreferences method createAutoSignInCheckbox.
private void createAutoSignInCheckbox() {
if (!ChromeFeatureList.isEnabled(CREDENTIAL_MANAGER_API)) {
return;
}
mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null);
mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH);
mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title);
mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX);
mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description);
mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PrefServiceBridge.getInstance().setPasswordManagerAutoSigninEnabled((boolean) newValue);
return true;
}
});
mAutoSignInSwitch.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {
@Override
public boolean isPreferenceControlledByPolicy(Preference preference) {
return PrefServiceBridge.getInstance().isPasswordManagerAutoSigninManaged();
}
});
getPreferenceScreen().addPreference(mAutoSignInSwitch);
mAutoSignInSwitch.setChecked(PrefServiceBridge.getInstance().isPasswordManagerAutoSigninEnabled());
}
use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.
the class PrivacyPreferences method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
privacyPrefManager.migrateNetworkPredictionPreferences();
addPreferencesFromResource(R.xml.privacy_preferences);
getActivity().setTitle(R.string.prefs_privacy);
setHasOptionsMenu(true);
PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
ChromeBaseCheckBoxPreference networkPredictionPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
networkPredictionPref.setOnPreferenceChangeListener(this);
networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference navigationErrorPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
navigationErrorPref.setOnPreferenceChangeListener(this);
navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference searchSuggestionsPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
searchSuggestionsPref.setOnPreferenceChangeListener(this);
searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
PreferenceScreen preferenceScreen = getPreferenceScreen();
if (!ContextualSearchFieldTrial.isEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
}
// Listen to changes to both Extended Reporting prefs.
ChromeBaseCheckBoxPreference legacyExtendedReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference scoutReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
scoutReportingPref.setOnPreferenceChangeListener(this);
scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
// Remove the extended reporting preference that is NOT active.
String extended_reporting_pref_to_remove = prefServiceBridge.isSafeBrowsingScoutReportingActive() ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));
ChromeBaseCheckBoxPreference safeBrowsingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
safeBrowsingPref.setOnPreferenceChangeListener(this);
safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
if (!PhysicalWeb.featureIsEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
}
updateSummaries();
}
use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.
the class SingleCategoryPreferences method updateThirdPartyCookiesCheckBox.
private void updateThirdPartyCookiesCheckBox() {
ChromeBaseCheckBoxPreference thirdPartyCookiesPref = (ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference(THIRD_PARTY_COOKIES_TOGGLE_KEY);
thirdPartyCookiesPref.setEnabled(PrefServiceBridge.getInstance().isAcceptCookiesEnabled());
thirdPartyCookiesPref.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {
@Override
public boolean isPreferenceControlledByPolicy(Preference preference) {
return PrefServiceBridge.getInstance().isBlockThirdPartyCookiesManaged();
}
});
}
use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.
the class SingleCategoryPreferences method updateNotificationsVibrateCheckBox.
private void updateNotificationsVibrateCheckBox() {
ChromeBaseCheckBoxPreference preference = (ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference(NOTIFICATIONS_VIBRATE_TOGGLE_KEY);
preference.setEnabled(PrefServiceBridge.getInstance().isNotificationsEnabled());
}
Aggregations