Java Code Examples for org.chromium.chrome.browser.ChromeFeatureList#getFieldTrialParamByFeatureAsBoolean()

The following examples show how to use org.chromium.chrome.browser.ChromeFeatureList#getFieldTrialParamByFeatureAsBoolean() . 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: DataReductionProxySettings.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the Data Reduction Proxy menu item should be shown in the main menu.
 */
public boolean shouldUseDataReductionMainMenuItem() {
    if (!ChromeFeatureList.isEnabled(ChromeFeatureList.DATA_REDUCTION_MAIN_MENU)) return false;

    if (ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.DATA_REDUCTION_MAIN_MENU, PARAM_PERSISTENT_MENU_ITEM_ENABLED,
                false)) {
        // If the Data Reduction Proxy is enabled, set the pref storing that the proxy has
        // ever been enabled.
        if (isDataReductionProxyEnabled()) {
            ContextUtils.getAppSharedPreferences()
                    .edit()
                    .putBoolean(DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, true)
                    .apply();
        }
        return ContextUtils.getAppSharedPreferences().getBoolean(
                DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, false);
    } else {
        return isDataReductionProxyEnabled();
    }
}
 
Example 2
Source File: NewTabPageView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Determines The maximum number of tiles to try and fit in a row. On smaller screens, there
 * may not be enough space to fit all of them.
 */
private int getMaxTileColumns() {
    if (!mUiConfig.getCurrentDisplayStyle().isSmall()
            && ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                       ChromeFeatureList.NTP_CONDENSED_TILE_LAYOUT,
                       PARAM_CONDENSED_TILE_LAYOUT_FOR_LARGE_SCREENS_ENABLED, false)) {
        return 5;
    }
    return 4;
}
 
Example 3
Source File: NewTabPageView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private boolean shouldUseCondensedTileLayout() {
    if (mUiConfig.getCurrentDisplayStyle().isSmall()) {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.NTP_CONDENSED_TILE_LAYOUT,
                PARAM_CONDENSED_TILE_LAYOUT_FOR_SMALL_SCREENS_ENABLED, false);
    }
    return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
            ChromeFeatureList.NTP_CONDENSED_TILE_LAYOUT,
            PARAM_CONDENSED_TILE_LAYOUT_FOR_LARGE_SCREENS_ENABLED, false);
}
 
Example 4
Source File: NewTabPageView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private boolean shouldShowLogo() {
    boolean condensedLayoutEnabled =
            ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_CONDENSED_LAYOUT);
    boolean showLogoInCondensedLayout = ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
            ChromeFeatureList.NTP_CONDENSED_LAYOUT, PARAM_CONDENSED_LAYOUT_SHOW_LOGO, false);
    return mSearchProviderHasLogo && (!condensedLayoutEnabled || showLogoInCondensedLayout);
}