Java Code Examples for org.chromium.chrome.browser.preferences.PrefServiceBridge#isContextualSearchDisabled()

The following examples show how to use org.chromium.chrome.browser.preferences.PrefServiceBridge#isContextualSearchDisabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @return The code for the Contextual Search preference.
 */
private static int getPreferenceValue() {
    PrefServiceBridge preferences = PrefServiceBridge.getInstance();
    if (preferences.isContextualSearchUninitialized()) {
        return PREFERENCE_UNINITIALIZED;
    } else if (preferences.isContextualSearchDisabled()) {
        return PREFERENCE_DISABLED;
    }
    return PREFERENCE_ENABLED;
}
 
Example 2
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @return The code for the Contextual Search preference.
 */
private static int getPreferenceValue() {
    PrefServiceBridge preferences = PrefServiceBridge.getInstance();
    if (preferences.isContextualSearchUninitialized()) {
        return PREFERENCE_UNINITIALIZED;
    } else if (preferences.isContextualSearchDisabled()) {
        return PREFERENCE_DISABLED;
    }
    return PREFERENCE_ENABLED;
}
 
Example 3
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @return The code for the Contextual Search preference.
 */
private static int getPreferenceValue() {
    PrefServiceBridge preferences = PrefServiceBridge.getInstance();
    if (preferences.isContextualSearchUninitialized()) {
        return PREFERENCE_UNINITIALIZED;
    } else if (preferences.isContextualSearchDisabled()) {
        return PREFERENCE_DISABLED;
    }
    return PREFERENCE_ENABLED;
}
 
Example 4
Source File: PrivacyPreferences.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Updates the summaries for several preferences.
 */
public void updateSummaries() {
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();

    CharSequence textOn = getActivity().getResources().getText(R.string.text_on);
    CharSequence textOff = getActivity().getResources().getText(R.string.text_off);

    CheckBoxPreference navigationErrorPref = (CheckBoxPreference) findPreference(
            PREF_NAVIGATION_ERROR);
    navigationErrorPref.setChecked(prefServiceBridge.isResolveNavigationErrorEnabled());

    CheckBoxPreference searchSuggestionsPref = (CheckBoxPreference) findPreference(
            PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setChecked(prefServiceBridge.isSearchSuggestEnabled());

    CheckBoxPreference extendedReportingPref =
            (CheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    extendedReportingPref.setChecked(
            prefServiceBridge.isSafeBrowsingExtendedReportingEnabled());

    CheckBoxPreference safeBrowsingPref =
            (CheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setChecked(prefServiceBridge.isSafeBrowsingEnabled());

    Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK);
    doNotTrackPref.setSummary(prefServiceBridge.isDoNotTrackEnabled() ? textOn : textOff);

    Preference contextualPref = findPreference(PREF_CONTEXTUAL_SEARCH);
    if (contextualPref != null) {
        boolean isContextualSearchEnabled = !prefServiceBridge.isContextualSearchDisabled();
        contextualPref.setSummary(isContextualSearchEnabled ? textOn : textOff);
    }

    Preference physicalWebPref = findPreference(PREF_PHYSICAL_WEB);
    if (physicalWebPref != null) {
        physicalWebPref.setSummary(privacyPrefManager.isPhysicalWebEnabled()
                ? textOn : textOff);
    }

    if (privacyPrefManager.isCellularExperimentEnabled()) {
        Preference usageAndCrashPref = findPreference(PREF_USAGE_AND_CRASH_REPORTING);
        usageAndCrashPref.setSummary(privacyPrefManager.isUsageAndCrashReportingEnabled()
                ? textOn : textOff);
    }
}
 
Example 5
Source File: PrivacyPreferences.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Updates the summaries for several preferences.
 */
public void updateSummaries() {
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();

    CharSequence textOn = getActivity().getResources().getText(R.string.text_on);
    CharSequence textOff = getActivity().getResources().getText(R.string.text_off);

    CheckBoxPreference navigationErrorPref = (CheckBoxPreference) findPreference(
            PREF_NAVIGATION_ERROR);
    if (navigationErrorPref != null) {
        navigationErrorPref.setChecked(
                prefServiceBridge.isResolveNavigationErrorEnabled());
    }

    CheckBoxPreference searchSuggestionsPref = (CheckBoxPreference) findPreference(
            PREF_SEARCH_SUGGESTIONS);
    if (searchSuggestionsPref != null) {
        searchSuggestionsPref.setChecked(prefServiceBridge.isSearchSuggestEnabled());
    }

    String extended_reporting_pref = prefServiceBridge.isSafeBrowsingScoutReportingActive()
            ? PREF_SAFE_BROWSING_SCOUT_REPORTING : PREF_SAFE_BROWSING_EXTENDED_REPORTING;
    CheckBoxPreference extendedReportingPref =
            (CheckBoxPreference) findPreference(extended_reporting_pref);
    if (extendedReportingPref != null) {
        extendedReportingPref.setChecked(
                prefServiceBridge.isSafeBrowsingExtendedReportingEnabled());
    }

    CheckBoxPreference safeBrowsingPref =
            (CheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    if (safeBrowsingPref != null) {
        safeBrowsingPref.setChecked(prefServiceBridge.isSafeBrowsingEnabled());
    }

    Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK);
    if (doNotTrackPref != null) {
        doNotTrackPref.setSummary(prefServiceBridge.isDoNotTrackEnabled() ? textOn : textOff);
    }

    Preference contextualPref = findPreference(PREF_CONTEXTUAL_SEARCH);
    if (contextualPref != null) {
        boolean isContextualSearchEnabled = !prefServiceBridge.isContextualSearchDisabled();
        contextualPref.setSummary(isContextualSearchEnabled ? textOn : textOff);
    }

    Preference physicalWebPref = findPreference(PREF_PHYSICAL_WEB);
    if (physicalWebPref != null) {
        physicalWebPref.setSummary(privacyPrefManager.isPhysicalWebEnabled()
                ? textOn : textOff);
    }

    Preference usageAndCrashPref = findPreference(PREF_USAGE_AND_CRASH_REPORTING);
    if (usageAndCrashPref != null) {
        usageAndCrashPref.setSummary(
                privacyPrefManager.isUsageAndCrashReportingPermittedByUser() ? textOn
                                                                             : textOff);
    }
}
 
Example 6
Source File: PrivacyPreferences.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Updates the summaries for several preferences.
 */
public void updateSummaries() {
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();

    CharSequence textOn = getActivity().getResources().getText(R.string.text_on);
    CharSequence textOff = getActivity().getResources().getText(R.string.text_off);

    CheckBoxPreference navigationErrorPref = (CheckBoxPreference) findPreference(
            PREF_NAVIGATION_ERROR);
    if (navigationErrorPref != null) {
        navigationErrorPref.setChecked(
                prefServiceBridge.isResolveNavigationErrorEnabled());
    }

    CheckBoxPreference searchSuggestionsPref = (CheckBoxPreference) findPreference(
            PREF_SEARCH_SUGGESTIONS);
    if (searchSuggestionsPref != null) {
        searchSuggestionsPref.setChecked(prefServiceBridge.isSearchSuggestEnabled());
    }

    String extended_reporting_pref = prefServiceBridge.isSafeBrowsingScoutReportingActive()
            ? PREF_SAFE_BROWSING_SCOUT_REPORTING : PREF_SAFE_BROWSING_EXTENDED_REPORTING;
    CheckBoxPreference extendedReportingPref =
            (CheckBoxPreference) findPreference(extended_reporting_pref);
    if (extendedReportingPref != null) {
        extendedReportingPref.setChecked(
                prefServiceBridge.isSafeBrowsingExtendedReportingEnabled());
    }

    CheckBoxPreference safeBrowsingPref =
            (CheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    if (safeBrowsingPref != null) {
        safeBrowsingPref.setChecked(prefServiceBridge.isSafeBrowsingEnabled());
    }

    Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK);
    if (doNotTrackPref != null) {
        doNotTrackPref.setSummary(prefServiceBridge.isDoNotTrackEnabled() ? textOn : textOff);
    }

    Preference contextualPref = findPreference(PREF_CONTEXTUAL_SEARCH);
    if (contextualPref != null) {
        boolean isContextualSearchEnabled = !prefServiceBridge.isContextualSearchDisabled();
        contextualPref.setSummary(isContextualSearchEnabled ? textOn : textOff);
    }

    Preference physicalWebPref = findPreference(PREF_PHYSICAL_WEB);
    if (physicalWebPref != null) {
        physicalWebPref.setSummary(privacyPrefManager.isPhysicalWebEnabled()
                ? textOn : textOff);
    }

    Preference usageAndCrashPref = findPreference(PREF_USAGE_AND_CRASH_REPORTING);
    if (usageAndCrashPref != null) {
        usageAndCrashPref.setSummary(
                privacyPrefManager.isUsageAndCrashReportingPermittedByUser() ? textOn
                                                                             : textOff);
    }
}