Java Code Examples for org.chromium.chrome.browser.preferences.PrefServiceBridge

The following examples show how to use org.chromium.chrome.browser.preferences.PrefServiceBridge. These examples are extracted from open source projects. 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 Project: 365browser   Source File: SingleCategoryPreferences.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Reset the preference screen an initialize it again.
 */
private void resetList() {
    // This will remove the combo box at the top and all the sites listed below it.
    getPreferenceScreen().removeAll();
    // And this will add the filter preference back (combo box).
    addPreferencesFromResource(R.xml.website_preferences);

    configureGlobalToggles();

    if ((mCategory.showAutoplaySites()
                && !PrefServiceBridge.getInstance().isAutoplayEnabled())
            || (mCategory.showJavaScriptSites()
                && !PrefServiceBridge.getInstance().javaScriptEnabled())
            || (mCategory.showBackgroundSyncSites()
                       && !PrefServiceBridge.getInstance().isBackgroundSyncAllowed())) {
        getPreferenceScreen().addPreference(
                new AddExceptionPreference(getActivity(), ADD_EXCEPTION_KEY,
                        getAddExceptionDialogMessage(), this));
    }
}
 
Example 2
Source Project: delion   Source File: AccountSigninView.java    License: Apache License 2.0 6 votes vote down vote up
private void showConfirmSigninPagePreviousAccountCheck() {
    String accountName = getSelectedAccountName();
    ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncLastAccountName(),
            accountName, ImportSyncType.PREVIOUS_DATA_FOUND, mDelegate.getFragmentManager(),
            getContext(), new ConfirmImportSyncDataDialog.Listener() {
                @Override
                public void onConfirm(boolean wipeData) {
                    SigninManager.wipeSyncUserDataIfRequired(wipeData)
                            .then(new Callback<Void>() {
                                @Override
                                public void onResult(Void v) {
                                    showConfirmSigninPage();
                                }
                            });
                }

                @Override
                public void onCancel() {
                    setButtonsEnabled(true);
                }
            });
}
 
Example 3
Source Project: delion   Source File: LanguagePreferences.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menu_id_targeted_help) {
        HelpAndFeedback.getInstance(getActivity())
                .show(getActivity(), getString(R.string.help_context_translate),
                        Profile.getLastUsedProfile(), null);
        return true;
    } else if (itemId == R.id.menu_id_reset) {
        PrefServiceBridge.getInstance().resetTranslateDefaults();
        Toast.makeText(getActivity(), getString(
                R.string.translate_prefs_toast_description),
                Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example 4
Source Project: AndroidChromium   Source File: PrivacyPreferences.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String key = preference.getKey();
    if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
        PrefServiceBridge.getInstance().setSearchSuggestEnabled((boolean) newValue);
    } else if (PREF_SAFE_BROWSING.equals(key)) {
        PrefServiceBridge.getInstance().setSafeBrowsingEnabled((boolean) newValue);
    } else if (PREF_SAFE_BROWSING_EXTENDED_REPORTING.equals(key)
               || PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
        PrefServiceBridge.getInstance().setSafeBrowsingExtendedReportingEnabled(
                (boolean) newValue);
    } else if (PREF_NETWORK_PREDICTIONS.equals(key)) {
        PrefServiceBridge.getInstance().setNetworkPredictionEnabled((boolean) newValue);
        PrecacheLauncher.updatePrecachingEnabled(getActivity());
    } else if (PREF_NAVIGATION_ERROR.equals(key)) {
        PrefServiceBridge.getInstance().setResolveNavigationErrorEnabled((boolean) newValue);
    }

    return true;
}
 
Example 5
Source Project: delion   Source File: SingleCategoryPreferences.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Reset the preference screen an initialize it again.
 */
private void resetList() {
    // This will remove the combo box at the top and all the sites listed below it.
    getPreferenceScreen().removeAll();
    // And this will add the filter preference back (combo box).
    addPreferencesFromResource(R.xml.website_preferences);

    configureGlobalToggles();

    if ((mCategory.showAutoplaySites()
                && !PrefServiceBridge.getInstance().isAutoplayEnabled())
            || (mCategory.showJavaScriptSites()
                && !PrefServiceBridge.getInstance().javaScriptEnabled())
            || (mCategory.showBackgroundSyncSites()
                       && !PrefServiceBridge.getInstance().isBackgroundSyncAllowed())) {
        getPreferenceScreen().addPreference(
                new AddExceptionPreference(getActivity(), ADD_EXCEPTION_KEY,
                        getAddExceptionDialogMessage(), this));
    }
}
 
Example 6
/**
 * Requests the browsing data corresponding to the given dialog options to be deleted.
 * @param options The dialog options whose corresponding data should be deleted.
 */
private final void clearBrowsingData(EnumSet<DialogOption> options,
        @Nullable String[] blacklistedDomains, @Nullable int[] blacklistedDomainReasons,
        @Nullable String[] ignoredDomains, @Nullable int[] ignoredDomainReasons) {
    showProgressDialog();

    int[] dataTypes = new int[options.size()];
    int i = 0;
    for (DialogOption option : options) {
        dataTypes[i] = option.getDataType();
        ++i;
    }

    Object spinnerSelection =
            ((SpinnerPreference) findPreference(PREF_TIME_RANGE)).getSelectedOption();
    int timePeriod = ((TimePeriodSpinnerOption) spinnerSelection).getTimePeriod();
    if (blacklistedDomains != null && blacklistedDomains.length != 0) {
        PrefServiceBridge.getInstance().clearBrowsingDataExcludingDomains(this, dataTypes,
                timePeriod, blacklistedDomains, blacklistedDomainReasons, ignoredDomains,
                ignoredDomainReasons);
    } else {
        PrefServiceBridge.getInstance().clearBrowsingData(this, dataTypes, timePeriod);
    }
}
 
Example 7
Source Project: AndroidChromium   Source File: UpdateMenuItemHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Handles a click on the update menu item.
 * @param activity The current {@link ChromeActivity}.
 */
public void onMenuItemClicked(ChromeActivity activity) {
    if (mUpdateUrl == null) return;

    // If the update menu item is showing because it was forced on through about://flags
    // then mLatestVersion may be null.
    if (mLatestVersion != null) {
        PrefServiceBridge.getInstance().setLatestVersionWhenClickedUpdateMenuItem(
                mLatestVersion);
    }

    // Fire an intent to open the URL.
    try {
        Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mUpdateUrl));
        activity.startActivity(launchIntent);
        recordItemClickedHistogram(ITEM_CLICKED_INTENT_LAUNCHED);
        PrefServiceBridge.getInstance().setClickedUpdateMenuItem(true);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch Activity for: %s", mUpdateUrl);
        recordItemClickedHistogram(ITEM_CLICKED_INTENT_FAILED);
    }
}
 
Example 8
Source Project: 365browser   Source File: ContextualSearchTabHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @return whether Contextual Search is enabled and active in this tab.
 */
private boolean isContextualSearchActive(ContentViewCore cvc) {
    ContextualSearchManager manager = getContextualSearchManager();
    if (manager == null) return false;

    return !cvc.getWebContents().isIncognito()
            && FirstRunStatus.getFirstRunFlowComplete()
            && !PrefServiceBridge.getInstance().isContextualSearchDisabled()
            && TemplateUrlService.getInstance().isDefaultSearchEngineGoogle()
            // Svelte and Accessibility devices are incompatible with the first-run flow and
            // Talkback has poor interaction with tap to search (see http://crbug.com/399708 and
            // http://crbug.com/396934).
            && !manager.isRunningInCompatibilityMode()
            && !(mTab.isShowingErrorPage() || mTab.isShowingInterstitialPage())
            && isDeviceOnline(manager);
}
 
Example 9
Source Project: 365browser   Source File: UpdateMenuItemHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Handles a click on the update menu item.
 * @param activity The current {@link ChromeActivity}.
 */
public void onMenuItemClicked(ChromeActivity activity) {
    if (mUpdateUrl == null) return;

    // If the update menu item is showing because it was forced on through about://flags
    // then mLatestVersion may be null.
    if (mLatestVersion != null) {
        PrefServiceBridge.getInstance().setLatestVersionWhenClickedUpdateMenuItem(
                mLatestVersion);
    }

    // Fire an intent to open the URL.
    try {
        Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mUpdateUrl));
        activity.startActivity(launchIntent);
        recordItemClickedHistogram(ITEM_CLICKED_INTENT_LAUNCHED);
        PrefServiceBridge.getInstance().setClickedUpdateMenuItem(true);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch Activity for: %s", mUpdateUrl);
        recordItemClickedHistogram(ITEM_CLICKED_INTENT_FAILED);
    }
}
 
Example 10
Source Project: AndroidChromium   Source File: PrivacyPreferences.java    License: Apache License 2.0 6 votes vote down vote up
private ManagedPreferenceDelegate createManagedPreferenceDelegate() {
    return new ManagedPreferenceDelegate() {
        @Override
        public boolean isPreferenceControlledByPolicy(Preference preference) {
            String key = preference.getKey();
            PrefServiceBridge prefs = PrefServiceBridge.getInstance();
            if (PREF_NAVIGATION_ERROR.equals(key)) {
                return prefs.isResolveNavigationErrorManaged();
            }
            if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
                return prefs.isSearchSuggestManaged();
            }
            if (PREF_SAFE_BROWSING_EXTENDED_REPORTING.equals(key)
                    || PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
                return prefs.isSafeBrowsingExtendedReportingManaged();
            }
            if (PREF_SAFE_BROWSING.equals(key)) {
                return prefs.isSafeBrowsingManaged();
            }
            if (PREF_NETWORK_PREDICTIONS.equals(key)) {
                return prefs.isNetworkPredictionManaged();
            }
            return false;
        }
    };
}
 
Example 11
Source Project: 365browser   Source File: TranslatePreferences.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menu_id_targeted_help) {
        HelpAndFeedback.getInstance(getActivity())
                .show(getActivity(), getString(R.string.help_context_translate),
                        Profile.getLastUsedProfile(), null);
        return true;
    } else if (itemId == R.id.menu_id_reset) {
        PrefServiceBridge.getInstance().resetTranslateDefaults();
        Toast.makeText(getActivity(), getString(
                R.string.translate_prefs_toast_description),
                Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example 12
Source Project: 365browser   Source File: AccountSigninView.java    License: Apache License 2.0 6 votes vote down vote up
private void showConfirmSigninPagePreviousAccountCheck(long seedingStartTime) {
    RecordHistogram.recordTimesHistogram("Signin.AndroidAccountSigninViewSeedingTime",
            SystemClock.elapsedRealtime() - seedingStartTime, TimeUnit.MILLISECONDS);
    String accountName = getSelectedAccountName();
    ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncLastAccountName(),
            accountName, ImportSyncType.PREVIOUS_DATA_FOUND,
            mDelegate.getFragmentManager(),
            getContext(), new ConfirmImportSyncDataDialog.Listener() {
                @Override
                public void onConfirm(boolean wipeData) {
                    SigninManager.wipeSyncUserDataIfRequired(wipeData)
                            .then(new Callback<Void>() {
                                @Override
                                public void onResult(Void v) {
                                    showConfirmSigninPage();
                                }
                            });
                }

                @Override
                public void onCancel() {
                    setButtonsEnabled(true);
                }
            });
}
 
Example 13
Source Project: AndroidChromium   Source File: FirstRunGlueImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void acceptTermsOfService(boolean allowCrashUpload) {
    UmaSessionStats.changeMetricsReportingConsent(allowCrashUpload);
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(CACHED_TOS_ACCEPTED_PREF, true)
            .apply();
    PrefServiceBridge.getInstance().setEulaAccepted();
}
 
Example 14
Source Project: AndroidChromium   Source File: UpdateMenuItemHelper.java    License: Apache License 2.0 5 votes vote down vote up
private void recordUpdateHistogram() {
    if (PrefServiceBridge.getInstance().getClickedUpdateMenuItem()) {
        RecordHistogram.recordEnumeratedHistogram(
                "GoogleUpdate.MenuItem.ActionTakenAfterItemClicked",
                mUpdateAvailable ? NOT_UPDATED : UPDATED, UPDATED_BOUNDARY);
        PrefServiceBridge.getInstance().setClickedUpdateMenuItem(false);
    }
}
 
Example 15
Source Project: delion   Source File: UmaSessionStats.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Updating Android preferences according to equivalent native preferences so that the values
 * can be retrieved while native preferences are not accessible.
 */
private void updatePreferences() {
    PrivacyPreferencesManager prefManager = PrivacyPreferencesManager.getInstance();

    // Update cellular experiment preference. Cellular experiment is ON by default.
    boolean cellularExperiment = true;
    if (TextUtils.equals("false", VariationsAssociatedData.getVariationParamValue(
                                        "UMA_EnableCellularLogUpload", "Enabled"))) {
        cellularExperiment = false;
    }
    prefManager.setCellularExperiment(cellularExperiment);

    // Migrate to new preferences for cellular experiment.
    if (cellularExperiment) {
        PrefServiceBridge prefBridge = PrefServiceBridge.getInstance();
        // If the native preference metrics reporting has not been set, then initialize it
        // based on the older android preference.
        if (!prefBridge.hasSetMetricsReporting()) {
            prefBridge.setMetricsReportingEnabled(prefManager.isUploadCrashDumpEnabled());
        }

        // Set new Android preference for usage and crash reporting.
        prefManager.setUsageAndCrashReporting(prefBridge.isMetricsReportingEnabled());
    }

    // Make sure preferences are in sync.
    prefManager.syncUsageAndCrashReportingPrefs();
}
 
Example 16
Source Project: delion   Source File: ChromeApplication.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Update the accept languages after changing Android locale setting. Doing so kills the
 * Activities but it doesn't kill the ChromeApplication, so this should be called in
 * {@link #onStart} instead of {@link #initialize}.
 */
private void updateAcceptLanguages() {
    PrefServiceBridge instance = PrefServiceBridge.getInstance();
    String localeString = Locale.getDefault().toString();  // ex) en_US, de_DE, zh_CN_#Hans
    if (hasLocaleChanged(localeString)) {
        instance.resetAcceptLanguages(localeString);
        // Clear cache so that accept-languages change can be applied immediately.
        // TODO(changwan): The underlying BrowsingDataRemover::Remove() is an asynchronous call.
        // So cache-clearing may not be effective if URL rendering can happen before
        // OnBrowsingDataRemoverDone() is called, in which case we may have to reload as well.
        // Check if it can happen.
        instance.clearBrowsingData(
                null, new int[]{ BrowsingDataType.CACHE }, TimePeriod.EVERYTHING);
    }
}
 
Example 17
Source Project: delion   Source File: ChromeApplication.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Honor the Android system setting about showing the last character of a password for a short
 * period of time.
 */
private void updatePasswordEchoState() {
    boolean systemEnabled = Settings.System.getInt(
            getApplicationContext().getContentResolver(),
            Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
    if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEnabled) return;

    PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled);
}
 
Example 18
Source Project: delion   Source File: ContextualSearchUma.java    License: 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 19
Source Project: delion   Source File: ContextualSearchPolicy.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return whether or not the Contextual Search Result should be preloaded before the user
 *         explicitly interacts with the feature.
 */
boolean shouldPrefetchSearchResult() {
    if (isMandatoryPromoAvailable()) return false;

    if (!PrefServiceBridge.getInstance().getNetworkPredictionEnabled()) return false;

    // We may not be prefetching due to the resolve/prefetch limit.
    if (isTapBeyondTheLimit()) return false;

    // We never preload on long-press so users can cut & paste without hitting the servers.
    return mSelectionController.getSelectionType() == SelectionType.TAP;
}
 
Example 20
Source Project: delion   Source File: ContextualSearchPolicy.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return Whether a promo is needed because the user is still undecided
 *         on enabling or disabling the feature.
 */
private boolean isUserUndecided() {
    // TODO(donnd) use dependency injection for the PrefServiceBridge instead!
    if (mDidOverrideDecidedStateForTesting) return !mDecidedStateForTesting;

    return PrefServiceBridge.getInstance().isContextualSearchUninitialized();
}
 
Example 21
Source Project: delion   Source File: ContextualSearchTabHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return whether Contextual Search is enabled and active in this tab.
 */
private boolean isContextualSearchActive(ContentViewCore cvc) {
    ContextualSearchManager manager = getContextualSearchManager();
    if (manager == null) return false;

    return !cvc.getWebContents().isIncognito()
            && !PrefServiceBridge.getInstance().isContextualSearchDisabled()
            && TemplateUrlService.getInstance().isDefaultSearchEngineGoogle()
            // Svelte and Accessibility devices are incompatible with the first-run flow and
            // Talkback has poor interaction with tap to search (see http://crbug.com/399708 and
            // http://crbug.com/396934).
            // TODO(jeremycho): Handle these cases.
            && !manager.isRunningInCompatibilityMode()
            && !(mTab.isShowingErrorPage() || mTab.isShowingInterstitialPage());
}
 
Example 22
Source Project: 365browser   Source File: HistoryItemView.java    License: Apache License 2.0 5 votes vote down vote up
private void updateRemoveButtonVisibility() {
    int removeButtonVisibility =
            !PrefServiceBridge.getInstance().canDeleteBrowsingHistory() ? View.GONE
                    : mRemoveButtonVisible ? View.VISIBLE : View.INVISIBLE;
    mRemoveButton.setVisibility(removeButtonVisibility);

    int endPadding = removeButtonVisibility == View.GONE ? mEndPadding : 0;
    ApiCompatibilityUtils.setPaddingRelative(mContentView,
            ApiCompatibilityUtils.getPaddingStart(mContentView),
            mContentView.getPaddingTop(), endPadding, mContentView.getPaddingBottom());
}
 
Example 23
Source Project: 365browser   Source File: WebsitePreferenceBridge.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return the list of all origins that have camera permissions in non-incognito mode.
 */
@SuppressWarnings("unchecked")
public static List<CameraInfo> getCameraInfo() {
    ArrayList<CameraInfo> list = new ArrayList<CameraInfo>();
    // Camera can be managed by the custodian of a supervised account or by enterprise policy.
    boolean managedOnly = !PrefServiceBridge.getInstance().isCameraUserModifiable();
    nativeGetCameraOrigins(list, managedOnly);
    return list;
}
 
Example 24
Source Project: 365browser   Source File: SingleCategoryPreferences.java    License: Apache License 2.0 5 votes vote down vote up
private void updateThirdPartyCookiesCheckBox() {
    ChromeBaseCheckBoxPreference thirdPartyCookiesPref = (ChromeBaseCheckBoxPreference)
            getPreferenceScreen().findPreference(THIRD_PARTY_COOKIES_TOGGLE_KEY);
    thirdPartyCookiesPref.setChecked(
            !PrefServiceBridge.getInstance().isBlockThirdPartyCookiesEnabled());
    thirdPartyCookiesPref.setEnabled(PrefServiceBridge.getInstance().isAcceptCookiesEnabled());
    thirdPartyCookiesPref.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {
        @Override
        public boolean isPreferenceControlledByPolicy(Preference preference) {
            return PrefServiceBridge.getInstance().isBlockThirdPartyCookiesManaged();
        }
    });
}
 
Example 25
Source Project: 365browser   Source File: ChromeActivitySessionTracker.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Honor the Android system setting about showing the last character of a password for a short
 * period of time.
 */
private void updatePasswordEchoState() {
    boolean systemEnabled = Settings.System.getInt(mApplication.getContentResolver(),
            Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
    if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEnabled) return;

    PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled);
}
 
Example 26
Source Project: delion   Source File: WebsitePreferenceBridge.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return the list of all sites that have fullscreen permissions in non-incognito mode.
 */
public static List<FullscreenInfo> getFullscreenInfo() {
    boolean managedOnly = PrefServiceBridge.getInstance().isFullscreenManaged();
    ArrayList<FullscreenInfo> list = new ArrayList<FullscreenInfo>();
    nativeGetFullscreenOrigins(list, managedOnly);
    return list;
}
 
Example 27
Source Project: delion   Source File: SiteSettingsCategory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether the current category is managed either by enterprise policy or by the
 * custodian of a supervised account.
 */
public boolean isManaged() {
    PrefServiceBridge prefs = PrefServiceBridge.getInstance();
    if (showBackgroundSyncSites()) return prefs.isBackgroundSyncManaged();
    if (showCameraSites()) return !prefs.isCameraUserModifiable();
    if (showCookiesSites()) return prefs.isAcceptCookiesManaged();
    if (showFullscreenSites()) return prefs.isFullscreenManaged();
    if (showGeolocationSites()) {
        return !prefs.isAllowLocationUserModifiable();
    }
    if (showJavaScriptSites()) return prefs.javaScriptManaged();
    if (showMicrophoneSites()) return !prefs.isMicUserModifiable();
    if (showPopupSites()) return prefs.isPopupsManaged();
    return false;
}
 
Example 28
Source Project: delion   Source File: SiteSettingsCategory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether the current category is managed by the custodian (e.g. parent, not an
 * enterprise admin) of the account if the account is supervised.
 */
public boolean isManagedByCustodian() {
    PrefServiceBridge prefs = PrefServiceBridge.getInstance();
    if (showGeolocationSites()) {
        return prefs.isAllowLocationManagedByCustodian();
    }
    if (showCameraSites()) {
        return prefs.isCameraManagedByCustodian();
    }
    if (showMicrophoneSites()) {
        return prefs.isMicManagedByCustodian();
    }
    return false;
}
 
Example 29
Source Project: 365browser   Source File: ContextualSearchUma.java    License: 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 30
Source Project: delion   Source File: SingleCategoryPreferences.java    License: Apache License 2.0 5 votes vote down vote up
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();
        }
    });
}