Java Code Examples for org.chromium.chrome.browser.preferences.ChromePreferenceManager#setCachedWebApkRuntimeEnabled()

The following examples show how to use org.chromium.chrome.browser.preferences.ChromePreferenceManager#setCachedWebApkRuntimeEnabled() . 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: ChromeWebApkHost.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Once native is loaded we can consult the command-line (set via about:flags) and also finch
 * state to see if we should enable WebAPKs.
 */
public static void cacheEnabledStateForNextLaunch() {
    ChromePreferenceManager preferenceManager =
            ChromePreferenceManager.getInstance(ContextUtils.getApplicationContext());

    boolean wasCommandLineEnabled = preferenceManager.getCachedWebApkCommandLineEnabled();
    boolean isCommandLineEnabled = isCommandLineFlagSet();
    if (isCommandLineEnabled != wasCommandLineEnabled) {
        // {@link launchWebApkRequirementsDialogIfNeeded()} is skipped the first time Chrome is
        // launched so do caching here instead.
        preferenceManager.setCachedWebApkCommandLineEnabled(isCommandLineEnabled);
    }

    boolean wasEnabled = isEnabledInPrefs();
    boolean isEnabled = computeEnabled();
    if (isEnabled != wasEnabled) {
        Log.d(TAG, "WebApk setting changed (%s => %s)", wasEnabled, isEnabled);
        preferenceManager.setCachedWebApkRuntimeEnabled(isEnabled);
    }
}
 
Example 2
Source File: ChromeWebApkHost.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Once native is loaded we can consult the command-line (set via about:flags) and also finch
 * state to see if we should enable WebAPKs.
 */
public static void cacheEnabledStateForNextLaunch() {
    ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance();

    boolean wasEnabled = isEnabledInPrefs();
    boolean isEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.IMPROVED_A2HS);
    if (isEnabled != wasEnabled) {
        Log.d(TAG, "WebApk setting changed (%s => %s)", wasEnabled, isEnabled);
        preferenceManager.setCachedWebApkRuntimeEnabled(isEnabled);
    }
}