Commit 03876e47 authored by Matt Simmons's avatar Matt Simmons Committed by Commit Bot

Make Start Surface flag imply grid enabled.

Bug: 1017977
Change-Id: I73b6f34d05f85a0ecce22b3d74e2ea8177533b83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879763Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Matt Simmons <mattsimmons@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710135}
parent a0dcf27c
......@@ -43,7 +43,6 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.tabmodel.TabSelectionType;
import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil;
import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter;
import org.chromium.chrome.browser.util.UrlConstants;
import org.chromium.chrome.tab_ui.R;
......@@ -250,7 +249,9 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
// Container view takes care of padding and margin in start surface.
if (mode != TabListCoordinator.TabListMode.CAROUSEL) {
int topControlsHeight = ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher()
// The start surface checks in this block are for top controls height and shadow margin
// to be set correctly for displaying the omnibox above the tab switcher.
int topControlsHeight = FeatureUtilities.isStartSurfaceEnabled()
? 0
: fullscreenManager.getTopControlsHeight();
mContainerViewModel.set(TOP_CONTROLS_HEIGHT, topControlsHeight);
......@@ -261,8 +262,7 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
ContextUtils.getApplicationContext().getResources().getDimensionPixelSize(
R.dimen.toolbar_height_no_shadow);
mContainerViewModel.set(SHADOW_TOP_MARGIN,
ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher() ? 0
: toolbarHeight);
FeatureUtilities.isStartSurfaceEnabled() ? 0 : toolbarHeight);
}
mContainerView = containerView;
......
......@@ -526,8 +526,9 @@ public class FeatureUtilities {
public static boolean isGridTabSwitcherEnabled() {
// TODO(yusufo): AccessibilityLayout check should not be here and the flow should support
// changing that setting while Chrome is alive.
// Having Tab Groups implies Grid Tab Switcher.
return isFlagEnabled(GRID_TAB_SWITCHER_ENABLED_KEY, false) || isTabGroupsAndroidEnabled();
// Having Tab Groups or Start implies Grid Tab Switcher.
return isFlagEnabled(GRID_TAB_SWITCHER_ENABLED_KEY, false) || isTabGroupsAndroidEnabled()
|| isStartSurfaceEnabled();
}
/**
......
......@@ -55,19 +55,6 @@ public final class ReturnToChromeExperimentsUtil {
return System.currentTimeMillis() > expirationTime;
}
/**
* Whether we should display the omnibox on the tab switcher in addition to the
* tab switcher toolbar.
*
* @return true if the tab grid and the start surface features are both ON, else false.
*/
public static boolean shouldShowOmniboxOnTabSwitcher() {
return ChromeFeatureList.isInitialized()
&& (FeatureUtilities.isGridTabSwitcherEnabled()
|| FeatureUtilities.isTabGroupsAndroidEnabled())
&& FeatureUtilities.isStartSurfaceEnabled();
}
/**
* Check if we should handle the navigation. If so, create a new tab and load the URL.
*
......@@ -111,7 +98,7 @@ public final class ReturnToChromeExperimentsUtil {
* @return The ChromeActivity if it is presenting the omnibox on the tab switcher, else null.
*/
private static ChromeActivity getActivityPresentingOverviewWithOmnibox() {
if (!shouldShowOmniboxOnTabSwitcher()) return null;
if (!FeatureUtilities.isStartSurfaceEnabled()) return null;
Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
if (!(activity instanceof ChromeActivity)) return null;
......
......@@ -90,7 +90,6 @@ import org.chromium.chrome.browser.tabmodel.TabModelObserver;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabSelectionType;
import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil;
import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator;
import org.chromium.chrome.browser.toolbar.top.ActionModeController;
import org.chromium.chrome.browser.toolbar.top.ActionModeController.ActionBarDelegate;
......@@ -955,8 +954,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF
mLocationBarModel.initializeWithNative();
mLocationBarModel.setShouldShowOmniboxInOverviewMode(
ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher());
FeatureUtilities.isStartSurfaceEnabled());
assert controlsVisibilityDelegate != null;
mControlsVisibilityDelegate = controlsVisibilityDelegate;
......
......@@ -106,8 +106,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout
mNewTabViewButton.setOnClickListener(this);
}
if ((usingHorizontalTabSwitcher() || FeatureUtilities.isGridTabSwitcherEnabled()
|| FeatureUtilities.isStartSurfaceEnabled())
if ((usingHorizontalTabSwitcher() || FeatureUtilities.isGridTabSwitcherEnabled())
&& PrefServiceBridge.getInstance().isIncognitoModeEnabled()) {
updateTabSwitchingElements(true);
}
......@@ -390,8 +389,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout
.getFieldTrialParamByFeature(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
"tab_grid_layout_android_new_tab")
.equals("NewTabVariation")
|| FeatureUtilities.isBottomToolbarEnabled()
|| !FeatureUtilities.isStartSurfaceEnabled() || mIncognitoToggleTabLayout == null) {
|| FeatureUtilities.isBottomToolbarEnabled() || mIncognitoToggleTabLayout == null) {
return;
}
boolean hasIncognitoTabs = hasIncognitoTabs();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment