Commit ca68129d authored by Matt Simmons's avatar Matt Simmons Committed by Commit Bot

Fix the omnibox on tab switcher when start surface is disabled.

* The omnibox was not showing unless one of the start surfaces was
enabled. This now checks both the tab-switcher-on-return flag and
the enable-start-surface flags.

R=yusufo@chromium.org

Bug: 1009940
Change-Id: Ic984c469e876e37190854fae838004304e827138
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1833928Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarGanggui Tang <gogerald@chromium.org>
Commit-Queue: Matt Simmons <mattsimmons@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701833}
parent a1f6bda6
......@@ -37,7 +37,10 @@ class TabListContainerProperties {
public static final PropertyModel.WritableIntPropertyKey SHADOW_TOP_MARGIN =
new PropertyModel.WritableIntPropertyKey();
public static final PropertyModel.WritableIntPropertyKey TOP_PADDING =
new PropertyModel.WritableIntPropertyKey();
public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {IS_VISIBLE, IS_INCOGNITO,
VISIBILITY_LISTENER, INITIAL_SCROLL_INDEX, ANIMATE_VISIBILITY_CHANGES,
TOP_CONTROLS_HEIGHT, BOTTOM_CONTROLS_HEIGHT, SHADOW_TOP_MARGIN};
TOP_CONTROLS_HEIGHT, BOTTOM_CONTROLS_HEIGHT, SHADOW_TOP_MARGIN, TOP_PADDING};
}
......@@ -11,6 +11,7 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerP
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.SHADOW_TOP_MARGIN;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_PADDING;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER;
import android.support.v7.widget.LinearLayoutManager;
......@@ -57,6 +58,9 @@ class TabListContainerViewBinder {
view.requestLayout();
} else if (SHADOW_TOP_MARGIN == propertyKey) {
view.setShadowTopMargin(model.get(SHADOW_TOP_MARGIN));
} else if (TOP_PADDING == propertyKey) {
view.setPadding(view.getPaddingLeft(), model.get(TOP_PADDING), view.getPaddingRight(),
view.getPaddingBottom());
}
}
}
......@@ -11,6 +11,7 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerP
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.SHADOW_TOP_MARGIN;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_PADDING;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER;
import android.graphics.Bitmap;
......@@ -248,7 +249,10 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
// Container view takes care of padding and margin in start surface.
if (mode != TabListCoordinator.TabListMode.CAROUSEL) {
// TODO(crbug.com/1010310): Remove the start surface check when tasks-only start surface
// can replace the omnibox check.
int topControlsHeight = ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher()
&& FeatureUtilities.isStartSurfaceEnabled()
? 0
: fullscreenManager.getTopControlsHeight();
mContainerViewModel.set(TOP_CONTROLS_HEIGHT, topControlsHeight);
......@@ -258,9 +262,17 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
int toolbarHeight =
ContextUtils.getApplicationContext().getResources().getDimensionPixelSize(
R.dimen.toolbar_height_no_shadow);
mContainerViewModel.set(SHADOW_TOP_MARGIN,
ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher() ? 0
: toolbarHeight);
if (ReturnToChromeExperimentsUtil.shouldShowOmniboxOnTabSwitcher()
&& !FeatureUtilities.isStartSurfaceEnabled()) {
// TODO(crbug.com/1010310): Remove this and the TOP_PADDING property once this can
// be replaced by tasks-only start surface mode.
mContainerViewModel.set(TOP_PADDING, toolbarHeight);
mContainerViewModel.set(SHADOW_TOP_MARGIN, 2 * toolbarHeight);
} else {
mContainerViewModel.set(SHADOW_TOP_MARGIN,
FeatureUtilities.isStartSurfaceEnabled() ? 0 : toolbarHeight);
}
}
mContainerView = containerView;
......
......@@ -65,7 +65,8 @@ public final class ReturnToChromeExperimentsUtil {
return ChromeFeatureList.isInitialized()
&& (FeatureUtilities.isGridTabSwitcherEnabled()
|| FeatureUtilities.isTabGroupsAndroidEnabled())
&& ChromeFeatureList.isEnabled(ChromeFeatureList.START_SURFACE_ANDROID);
&& (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_SWITCHER_ON_RETURN)
|| FeatureUtilities.isStartSurfaceEnabled());
}
/**
......
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