Java Code Examples for org.chromium.base.CommandLine#hasSwitch()

The following examples show how to use org.chromium.base.CommandLine#hasSwitch() . 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: ApplicationInitialization.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}
 
Example 2
Source File: NotificationPlatformBridge.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Determines whether to use standard notification layouts, using NotificationCompat.Builder,
 * or custom layouts using Chrome's own templates.
 *
 * The --{enable,disable}-web-notification-custom-layouts command line flags take precedence.
 *
 * Normally a standard layout is used on Android N+, and a custom layout is used on older
 * versions of Android. But if the notification has a content image, there isn't enough room for
 * the Site Settings button to go on its own line when showing an image, nor is there enough
 * room for action button icons, so a standard layout will be used here even on old versions.
 *
 * @param hasImage Whether the notification has a content image.
 * @return Whether custom layouts should be used.
 */
@VisibleForTesting
static boolean useCustomLayouts(boolean hasImage) {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.ENABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return true;
    }
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        return false;
    }
    if (hasImage) {
        return false;
    }
    return true;
}
 
Example 3
Source File: ApplicationInitialization.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the top controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}
 
Example 4
Source File: NotificationPlatformBridge.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Determines whether to use standard notification layouts, using NotificationCompat.Builder,
 * or custom layouts using Chrome's own templates.
 *
 * The --{enable,disable}-web-notification-custom-layouts command line flags take precedence.
 *
 * Normally a standard layout is used on Android N+, and a custom layout is used on older
 * versions of Android. But if the notification has a content image, there isn't enough room for
 * the Site Settings button to go on its own line when showing an image, nor is there enough
 * room for action button icons, so a standard layout will be used here even on old versions.
 *
 * @param hasImage Whether the notification has a content image.
 * @return Whether custom layouts should be used.
 */
@VisibleForTesting
static boolean useCustomLayouts(boolean hasImage) {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.ENABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return true;
    }
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return false;
    }
    if (Build.VERSION.CODENAME.equals("N") || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
        return false;
    }
    if (hasImage) {
        return false;
    }
    return true;
}
 
Example 5
Source File: ApplicationInitialization.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    Log.w("renshuai: ", "hello" + threshold.coerceToString().toString());
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());

}
 
Example 6
Source File: InstantAppsHandler.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Cache whether the Instant Apps feature is enabled.
 * This should only be called with the native library loaded.
 */
public void cacheInstantAppsEnabled() {
    Context context = ContextUtils.getApplicationContext();
    boolean isEnabled = false;
    boolean wasEnabled = isEnabled(context);
    CommandLine instance = CommandLine.getInstance();
    if (instance.hasSwitch(ChromeSwitches.DISABLE_APP_LINK)) {
        isEnabled = false;
    } else if (instance.hasSwitch(ChromeSwitches.ENABLE_APP_LINK)) {
        isEnabled = true;
    } else {
        String experiment = FieldTrialList.findFullName(INSTANT_APPS_EXPERIMENT_NAME);
        if (INSTANT_APPS_DISABLED_ARM.equals(experiment)) {
            isEnabled = false;
        } else if (INSTANT_APPS_ENABLED_ARM.equals(experiment)) {
            isEnabled = true;
        }
    }

    if (isEnabled != wasEnabled) {
        ChromePreferenceManager.getInstance(context).setCachedInstantAppsEnabled(isEnabled);
    }
}
 
Example 7
Source File: PartnerBrowserCustomizations.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @return Home page URL from Android provider. If null, that means either there is no homepage
 *         provider or provider set it to null to disable homepage.
 */
public static String getHomePageUrl() {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING)) {
        return commandLine.getSwitchValue(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING);
    }
    return sHomepage;
}
 
Example 8
Source File: FeatureUtilities.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Caches which flavor of Herb the user prefers from native.
 */
private static void cacheHerbFlavor() {
    Context context = ContextUtils.getApplicationContext();
    if (isHerbDisallowed(context)) return;

    String oldFlavor = getHerbFlavor();

    // Check the experiment value before the command line to put the user in the correct group.
    // The first clause does the null checks so so we can freely use the startsWith() function.
    String newFlavor = FieldTrialList.findFullName(HERB_EXPERIMENT_NAME);
    Log.d(TAG, "Experiment flavor: " + newFlavor);
    if (!TextUtils.isEmpty(newFlavor)
            && newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_ELDERBERRY)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    } else {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    }

    CommandLine instance = CommandLine.getInstance();
    if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_DISABLED_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_ELDERBERRY_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    }

    Log.d(TAG, "Caching flavor: " + newFlavor);
    sCachedHerbFlavor = newFlavor;

    if (!TextUtils.equals(oldFlavor, newFlavor)) {
        ChromePreferenceManager.getInstance().setCachedHerbFlavor(newFlavor);
    }
}
 
Example 9
Source File: PartnerBrowserCustomizations.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @return Home page URL from Android provider. If null, that means either there is no homepage
 *         provider or provider set it to null to disable homepage.
 */
public static String getHomePageUrl() {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING)) {
        return commandLine.getSwitchValue(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING);
    }
    return sHomepage;
}
 
Example 10
Source File: FeatureUtilities.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Caches which flavor of Herb the user prefers from native.
 */
private static void cacheHerbFlavor() {
    Context context = ContextUtils.getApplicationContext();
    if (isHerbDisallowed(context)) return;

    String oldFlavor = getHerbFlavor();

    // Check the experiment value before the command line to put the user in the correct group.
    // The first clause does the null checks so so we can freely use the startsWith() function.
    String newFlavor = FieldTrialList.findFullName(HERB_EXPERIMENT_NAME);
    Log.d(TAG, "Experiment flavor: " + newFlavor);
    if (!TextUtils.isEmpty(newFlavor)
            && newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_ELDERBERRY)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    } else {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    }

    CommandLine instance = CommandLine.getInstance();
    if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_DISABLED_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_ELDERBERRY_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    }

    Log.d(TAG, "Caching flavor: " + newFlavor);
    sCachedHerbFlavor = newFlavor;

    if (!TextUtils.equals(oldFlavor, newFlavor)) {
        ChromePreferenceManager.getInstance(context).setCachedHerbFlavor(newFlavor);
    }
}
 
Example 11
Source File: DeviceClassManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * The {@link DeviceClassManager} constructor should be self contained and
 * rely on system information and command line flags.
 */
private DeviceClassManager() {
    // Device based configurations.
    if (SysUtils.isLowEndDevice()) {
        mEnableSnapshots = false;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = true;
        mEnableAnimations = false;
        mEnablePrerendering = false;
        mEnableToolbarSwipe = false;
        mDisableDomainReliability = true;
    } else {
        mEnableSnapshots = true;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = false;
        mEnableAnimations = true;
        mEnablePrerendering = true;
        mEnableToolbarSwipe = true;
        mDisableDomainReliability = false;
    }

    if (DeviceFormFactor.isTablet(ContextUtils.getApplicationContext())) {
        mEnableAccessibilityLayout = false;
    }

    // Flag based configurations.
    CommandLine commandLine = CommandLine.getInstance();
    mEnableAccessibilityLayout |= commandLine
            .hasSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER);
    mEnableFullscreen =
            !commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN);

    // Related features.
    if (mEnableAccessibilityLayout) {
        mEnableAnimations = false;
    }
}
 
Example 12
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) {
        getIntent().setData(null);
    }
}
 
Example 13
Source File: PartnerBrowserCustomizations.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @return Home page URL from Android provider. If null, that means either there is no homepage
 *         provider or provider set it to null to disable homepage.
 */
public static String getHomePageUrl() {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING)) {
        return commandLine.getSwitchValue(ChromeSwitches.PARTNER_HOMEPAGE_FOR_TESTING);
    }
    return sHomepage;
}
 
Example 14
Source File: DeviceClassManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * The {@link DeviceClassManager} constructor should be self contained and
 * rely on system information and command line flags.
 */
private DeviceClassManager() {
    // Device based configurations.
    if (SysUtils.isLowEndDevice()) {
        mEnableSnapshots = false;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = true;
        mEnableAnimations = false;
        mEnablePrerendering = false;
        mEnableToolbarSwipe = false;
        mDisableDomainReliability = true;
    } else {
        mEnableSnapshots = true;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = false;
        mEnableAnimations = true;
        mEnablePrerendering = true;
        mEnableToolbarSwipe = true;
        mDisableDomainReliability = false;
    }

    if (DeviceFormFactor.isTablet(ContextUtils.getApplicationContext())) {
        mEnableAccessibilityLayout = false;
    }

    // Flag based configurations.
    CommandLine commandLine = CommandLine.getInstance();
    mEnableAccessibilityLayout |= commandLine
            .hasSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER);
    mEnableFullscreen =
            !commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN);
    mEnableToolbarSwipeInDocumentMode =
            commandLine.hasSwitch(ChromeSwitches.ENABLE_TOOLBAR_SWIPE_IN_DOCUMENT_MODE);

    // Related features.
    if (mEnableAccessibilityLayout) {
        mEnableAnimations = false;
    }
}
 
Example 15
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) {
        getIntent().setData(null);
    }
}
 
Example 16
Source File: NotificationPlatformBridge.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Determines whether to use standard notification layouts, using NotificationCompat.Builder,
 * or custom layouts using Chrome's own templates.
 *
 * The --{enable,disable}-web-notification-custom-layouts command line flags take precedence.
 *
 * @return Whether custom layouts should be used.
 */
@VisibleForTesting
static boolean useCustomLayouts() {
    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.ENABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return true;
    }
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) {
        return false;
    }
    if (Build.VERSION.CODENAME.equals("N") || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
        return false;
    }
    return true;
}
 
Example 17
Source File: CompositorView.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Reset the commandline flags. This gets called after we switch over to the
 * native command line.
 */
public void resetFlags() {
    CommandLine commandLine = CommandLine.getInstance();
    mEnableTabletTabStack = commandLine.hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK)
            && DeviceFormFactor.isTablet(getContext());
}
 
Example 18
Source File: FeatureUtilities.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Caches which flavor of Herb the user prefers from native.
 */
private static void cacheHerbFlavor() {
    Context context = ContextUtils.getApplicationContext();
    if (isHerbDisallowed(context)) return;

    String oldFlavor = getHerbFlavor();

    // Check the experiment value before the command line to put the user in the correct group.
    // The first clause does the null checks so so we can freely use the startsWith() function.
    String newFlavor = FieldTrialList.findFullName(HERB_EXPERIMENT_NAME);
    Log.d(TAG, "Experiment flavor: " + newFlavor);
    if (TextUtils.isEmpty(newFlavor)
            || newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_CONTROL)
            || newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_DEFAULT)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    } else if (newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_ANISE)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ANISE;
    } else if (newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_BASIL)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_BASIL;
    } else if (newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_CHIVE)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_CHIVE;
    } else if (newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_DILL)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DILL;
    } else if (newFlavor.startsWith(ChromeSwitches.HERB_FLAVOR_ELDERBERRY)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    }

    CommandLine instance = CommandLine.getInstance();
    if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_DISABLED_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DISABLED;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_ANISE_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ANISE;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_BASIL_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_BASIL;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_CHIVE_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_CHIVE;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_DILL_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_DILL;
    } else if (instance.hasSwitch(ChromeSwitches.HERB_FLAVOR_ELDERBERRY_SWITCH)) {
        newFlavor = ChromeSwitches.HERB_FLAVOR_ELDERBERRY;
    }

    Log.d(TAG, "Caching flavor: " + newFlavor);
    sCachedHerbFlavor = newFlavor;

    if (!TextUtils.equals(oldFlavor, newFlavor)) {
        ChromePreferenceManager.getInstance(context).setCachedHerbFlavor(newFlavor);
    }
}
 
Example 19
Source File: CompositorView.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Reset the commandline flags. This gets called after we switch over to the
 * native command line.
 */
public void resetFlags() {
    CommandLine commandLine = CommandLine.getInstance();
    mEnableTabletTabStack = commandLine.hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK)
            && DeviceFormFactor.isTablet(getContext());
}
 
Example 20
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaBase.isProbablyFreshInstall(this)) {
        getIntent().setData(null);
    }

    launchFirstRunExperience();
}