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; ...@@ -43,7 +43,6 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabModelUtils; import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.tabmodel.TabSelectionType; 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.tasks.tab_groups.TabGroupModelFilter;
import org.chromium.chrome.browser.util.UrlConstants; import org.chromium.chrome.browser.util.UrlConstants;
import org.chromium.chrome.tab_ui.R; import org.chromium.chrome.tab_ui.R;
...@@ -250,7 +249,9 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView ...@@ -250,7 +249,9 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
// Container view takes care of padding and margin in start surface. // Container view takes care of padding and margin in start surface.
if (mode != TabListCoordinator.TabListMode.CAROUSEL) { 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 ? 0
: fullscreenManager.getTopControlsHeight(); : fullscreenManager.getTopControlsHeight();
mContainerViewModel.set(TOP_CONTROLS_HEIGHT, topControlsHeight); mContainerViewModel.set(TOP_CONTROLS_HEIGHT, topControlsHeight);
...@@ -261,8 +262,7 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView ...@@ -261,8 +262,7 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
ContextUtils.getApplicationContext().getResources().getDimensionPixelSize( ContextUtils.getApplicationContext().getResources().getDimensionPixelSize(
R.dimen.toolbar_height_no_shadow); R.dimen.toolbar_height_no_shadow);
mContainerViewModel.set(SHADOW_TOP_MARGIN, mContainerViewModel.set(SHADOW_TOP_MARGIN,
ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher() ? 0 FeatureUtilities.isStartSurfaceEnabled() ? 0 : toolbarHeight);
: toolbarHeight);
} }
mContainerView = containerView; mContainerView = containerView;
......
...@@ -526,8 +526,9 @@ public class FeatureUtilities { ...@@ -526,8 +526,9 @@ public class FeatureUtilities {
public static boolean isGridTabSwitcherEnabled() { public static boolean isGridTabSwitcherEnabled() {
// TODO(yusufo): AccessibilityLayout check should not be here and the flow should support // TODO(yusufo): AccessibilityLayout check should not be here and the flow should support
// changing that setting while Chrome is alive. // changing that setting while Chrome is alive.
// Having Tab Groups implies Grid Tab Switcher. // Having Tab Groups or Start implies Grid Tab Switcher.
return isFlagEnabled(GRID_TAB_SWITCHER_ENABLED_KEY, false) || isTabGroupsAndroidEnabled(); return isFlagEnabled(GRID_TAB_SWITCHER_ENABLED_KEY, false) || isTabGroupsAndroidEnabled()
|| isStartSurfaceEnabled();
} }
/** /**
......
...@@ -55,19 +55,6 @@ public final class ReturnToChromeExperimentsUtil { ...@@ -55,19 +55,6 @@ public final class ReturnToChromeExperimentsUtil {
return System.currentTimeMillis() > expirationTime; 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. * 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 { ...@@ -111,7 +98,7 @@ public final class ReturnToChromeExperimentsUtil {
* @return The ChromeActivity if it is presenting the omnibox on the tab switcher, else null. * @return The ChromeActivity if it is presenting the omnibox on the tab switcher, else null.
*/ */
private static ChromeActivity getActivityPresentingOverviewWithOmnibox() { private static ChromeActivity getActivityPresentingOverviewWithOmnibox() {
if (!shouldShowOmniboxOnTabSwitcher()) return null; if (!FeatureUtilities.isStartSurfaceEnabled()) return null;
Activity activity = ApplicationStatus.getLastTrackedFocusedActivity(); Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
if (!(activity instanceof ChromeActivity)) return null; if (!(activity instanceof ChromeActivity)) return null;
......
...@@ -90,7 +90,6 @@ import org.chromium.chrome.browser.tabmodel.TabModelObserver; ...@@ -90,7 +90,6 @@ import org.chromium.chrome.browser.tabmodel.TabModelObserver;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabSelectionType; 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.bottom.BottomControlsCoordinator;
import org.chromium.chrome.browser.toolbar.top.ActionModeController; import org.chromium.chrome.browser.toolbar.top.ActionModeController;
import org.chromium.chrome.browser.toolbar.top.ActionModeController.ActionBarDelegate; import org.chromium.chrome.browser.toolbar.top.ActionModeController.ActionBarDelegate;
...@@ -955,8 +954,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF ...@@ -955,8 +954,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF
mLocationBarModel.initializeWithNative(); mLocationBarModel.initializeWithNative();
mLocationBarModel.setShouldShowOmniboxInOverviewMode( mLocationBarModel.setShouldShowOmniboxInOverviewMode(
ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher()); FeatureUtilities.isStartSurfaceEnabled());
assert controlsVisibilityDelegate != null; assert controlsVisibilityDelegate != null;
mControlsVisibilityDelegate = controlsVisibilityDelegate; mControlsVisibilityDelegate = controlsVisibilityDelegate;
......
...@@ -106,8 +106,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout ...@@ -106,8 +106,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout
mNewTabViewButton.setOnClickListener(this); mNewTabViewButton.setOnClickListener(this);
} }
if ((usingHorizontalTabSwitcher() || FeatureUtilities.isGridTabSwitcherEnabled() if ((usingHorizontalTabSwitcher() || FeatureUtilities.isGridTabSwitcherEnabled())
|| FeatureUtilities.isStartSurfaceEnabled())
&& PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { && PrefServiceBridge.getInstance().isIncognitoModeEnabled()) {
updateTabSwitchingElements(true); updateTabSwitchingElements(true);
} }
...@@ -390,8 +389,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout ...@@ -390,8 +389,7 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout
.getFieldTrialParamByFeature(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, .getFieldTrialParamByFeature(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID,
"tab_grid_layout_android_new_tab") "tab_grid_layout_android_new_tab")
.equals("NewTabVariation") .equals("NewTabVariation")
|| FeatureUtilities.isBottomToolbarEnabled() || FeatureUtilities.isBottomToolbarEnabled() || mIncognitoToggleTabLayout == null) {
|| !FeatureUtilities.isStartSurfaceEnabled() || mIncognitoToggleTabLayout == null) {
return; return;
} }
boolean hasIncognitoTabs = hasIncognitoTabs(); 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