Commit 136c698d authored by Theresa's avatar Theresa Committed by Commit Bot

Remove BottomSheet code from toolbar/ and omnibox/

BUG=814528

Change-Id: Iacdefc02c01d04079d7c1d62368bd7aaabaf2e8c
Reviewed-on: https://chromium-review.googlesource.com/c/1289707Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600973}
parent dbb46b5e
...@@ -18,7 +18,6 @@ import org.chromium.chrome.browser.toolbar.Toolbar; ...@@ -18,7 +18,6 @@ import org.chromium.chrome.browser.toolbar.Toolbar;
import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback; import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback;
import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowAndroid;
/** /**
...@@ -83,12 +82,6 @@ public interface LocationBar extends UrlBarDelegate { ...@@ -83,12 +82,6 @@ public interface LocationBar extends UrlBarDelegate {
*/ */
ToolbarDataProvider getToolbarDataProvider(); ToolbarDataProvider getToolbarDataProvider();
/**
* Set the bottom sheet for Chrome Home.
* @param sheet The bottom sheet for Chrome Home if it exists.
*/
void setBottomSheet(BottomSheet sheet);
/** /**
* Initialize controls that will act as hooks to various functions. * Initialize controls that will act as hooks to various functions.
* @param windowDelegate {@link WindowDelegate} that will provide {@link Window} related info. * @param windowDelegate {@link WindowDelegate} that will provide {@link Window} related info.
......
...@@ -61,7 +61,6 @@ import org.chromium.chrome.browser.toolbar.ToolbarManager; ...@@ -61,7 +61,6 @@ import org.chromium.chrome.browser.toolbar.ToolbarManager;
import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.ScrimView.ScrimParams; import org.chromium.chrome.browser.widget.ScrimView.ScrimParams;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.ui.base.DeviceFormFactor; import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.base.PageTransition; import org.chromium.ui.base.PageTransition;
...@@ -90,9 +89,6 @@ public class LocationBarLayout extends FrameLayout ...@@ -90,9 +89,6 @@ public class LocationBarLayout extends FrameLayout
protected View mUrlBar; protected View mUrlBar;
private final boolean mIsTablet; private final boolean mIsTablet;
/** A handle to the bottom sheet for chrome home. */
protected BottomSheet mBottomSheet;
protected UrlBarCoordinator mUrlCoordinator; protected UrlBarCoordinator mUrlCoordinator;
protected AutocompleteCoordinator mAutocompleteCoordinator; protected AutocompleteCoordinator mAutocompleteCoordinator;
...@@ -195,11 +191,6 @@ public class LocationBarLayout extends FrameLayout ...@@ -195,11 +191,6 @@ public class LocationBarLayout extends FrameLayout
return mWindowDelegate; return mWindowDelegate;
} }
@Override
public BottomSheet getBottomSheet() {
return mBottomSheet;
}
@Override @Override
public View getAnchorView() { public View getAnchorView() {
return getRootView().findViewById(R.id.toolbar); return getRootView().findViewById(R.id.toolbar);
...@@ -561,11 +552,6 @@ public class LocationBarLayout extends FrameLayout ...@@ -561,11 +552,6 @@ public class LocationBarLayout extends FrameLayout
mUrlCoordinator.setOnFocusChangedCallback(this::onUrlFocusChange); mUrlCoordinator.setOnFocusChangedCallback(this::onUrlFocusChange);
} }
@Override
public void setBottomSheet(BottomSheet sheet) {
mBottomSheet = sheet;
}
@Override @Override
public void addUrlFocusChangeListener(UrlFocusChangeListener listener) { public void addUrlFocusChangeListener(UrlFocusChangeListener listener) {
mUrlFocusChangeListeners.addObserver(listener); mUrlFocusChangeListeners.addObserver(listener);
...@@ -621,10 +607,7 @@ public class LocationBarLayout extends FrameLayout ...@@ -621,10 +607,7 @@ public class LocationBarLayout extends FrameLayout
*/ */
@Override @Override
public int getUrlContainerMarginEnd() { public int getUrlContainerMarginEnd() {
// When Chrome Home is enabled, the URL actions container slides out of view during the boolean addMarginForActionsContainer = !mUrlFocusChangeInProgress || isUrlBarFocused();
// URL defocus animation. Adding margin during this animation creates a hole.
boolean addMarginForActionsContainer =
mBottomSheet == null || !mUrlFocusChangeInProgress || isUrlBarFocused();
int urlContainerMarginEnd = 0; int urlContainerMarginEnd = 0;
if (addMarginForActionsContainer) { if (addMarginForActionsContainer) {
...@@ -983,12 +966,7 @@ public class LocationBarLayout extends FrameLayout ...@@ -983,12 +966,7 @@ public class LocationBarLayout extends FrameLayout
loadUrlParams.setInputStartTimestamp(inputStart); loadUrlParams.setInputStartTimestamp(inputStart);
} }
// If the bottom sheet exists, route the navigation through it instead of the tab.
if (mBottomSheet != null) {
mBottomSheet.loadUrl(loadUrlParams, currentTab.isIncognito());
} else {
currentTab.loadUrl(loadUrlParams); currentTab.loadUrl(loadUrlParams);
}
RecordUserAction.record("MobileOmniboxUse"); RecordUserAction.record("MobileOmniboxUse");
} }
LocaleManager.getInstance().recordLocaleBasedSearchMetrics(false, url, transition); LocaleManager.getInstance().recordLocaleBasedSearchMetrics(false, url, transition);
......
...@@ -16,8 +16,6 @@ import android.view.WindowManager; ...@@ -16,8 +16,6 @@ import android.view.WindowManager;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.WindowDelegate; import org.chromium.chrome.browser.WindowDelegate;
import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.ntp.NewTabPage;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver;
/** /**
* A location bar implementation specific for smaller/phone screens. * A location bar implementation specific for smaller/phone screens.
...@@ -138,22 +136,16 @@ public class LocationBarPhone extends LocationBarLayout { ...@@ -138,22 +136,16 @@ public class LocationBarPhone extends LocationBarLayout {
}, KEYBOARD_HIDE_DELAY_MS); }, KEYBOARD_HIDE_DELAY_MS);
// Convert the keyboard back to resize mode (delay the change for an arbitrary amount // Convert the keyboard back to resize mode (delay the change for an arbitrary amount
// of time in hopes the keyboard will be completely hidden before making this change). // of time in hopes the keyboard will be completely hidden before making this change).
// If Chrome Home is enabled, it will handle its own mode changes.
if (mBottomSheet == null) {
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE, true); setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE, true);
}
mUrlActionContainer.setVisibility(GONE); mUrlActionContainer.setVisibility(GONE);
} else { } else {
// If Chrome Home is enabled, it will handle its own mode changes.
if (mBottomSheet == null) {
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN, false); setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN, false);
}
getWindowAndroid().getKeyboardDelegate().showKeyboard(mUrlBar); getWindowAndroid().getKeyboardDelegate().showKeyboard(mUrlBar);
} }
setUrlFocusChangeInProgress(false); setUrlFocusChangeInProgress(false);
NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab(); NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab();
if (hasFocus && ntp != null && ntp.isLocationBarShownInNTP() && mBottomSheet == null) { if (hasFocus && ntp != null && ntp.isLocationBarShownInNTP()) {
updateFadingBackgroundView(true, true); updateFadingBackgroundView(true, true);
} }
} }
...@@ -196,26 +188,4 @@ public class LocationBarPhone extends LocationBarLayout { ...@@ -196,26 +188,4 @@ public class LocationBarPhone extends LocationBarLayout {
delegate.setWindowSoftInputMode(softInputMode); delegate.setWindowSoftInputMode(softInputMode);
} }
} }
@Override
public void setBottomSheet(BottomSheet sheet) {
super.setBottomSheet(sheet);
sheet.addObserver(new EmptyBottomSheetObserver() {
@Override
public void onSheetStateChanged(@BottomSheet.SheetState int state) {
switch (state) {
case BottomSheet.SheetState.FULL:
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN, false);
break;
case BottomSheet.SheetState.PEEK:
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE, true);
break;
default:
setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING, false);
}
}
});
}
} }
...@@ -22,7 +22,6 @@ import org.chromium.chrome.R; ...@@ -22,7 +22,6 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.WindowDelegate; import org.chromium.chrome.browser.WindowDelegate;
import org.chromium.chrome.browser.omnibox.suggestions.OmniboxResultsAdapter.OmniboxResultItem; import org.chromium.chrome.browser.omnibox.suggestions.OmniboxResultsAdapter.OmniboxResultItem;
import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -64,10 +63,6 @@ public class OmniboxSuggestionsList extends ListView { ...@@ -64,10 +63,6 @@ public class OmniboxSuggestionsList extends ListView {
@Nullable @Nullable
View getAlignmentView(); View getAlignmentView();
/** Return the bottom sheet for the containing UI to be used in sizing. */
@Nullable
BottomSheet getBottomSheet();
/** Return the delegate used to interact with the Window. */ /** Return the delegate used to interact with the Window. */
WindowDelegate getWindowDelegate(); WindowDelegate getWindowDelegate();
...@@ -265,11 +260,7 @@ public class OmniboxSuggestionsList extends ListView { ...@@ -265,11 +260,7 @@ public class OmniboxSuggestionsList extends ListView {
mEmbedder.getWindowDelegate().getWindowVisibleDisplayFrame(mTempRect); mEmbedder.getWindowDelegate().getWindowVisibleDisplayFrame(mTempRect);
int decorHeight = mEmbedder.getWindowDelegate().getDecorViewHeight(); int decorHeight = mEmbedder.getWindowDelegate().getDecorViewHeight();
int additionalHeightForBottomNavMenu = mEmbedder.getBottomSheet() != null int availableViewportHeight = Math.min(mTempRect.height(), decorHeight);
? mEmbedder.getBottomSheet().getToolbarShadowHeight()
: 0;
int availableViewportHeight =
Math.min(mTempRect.height(), decorHeight) + additionalHeightForBottomNavMenu;
int availableListHeight = availableViewportHeight - anchorBottomRelativeToContent; int availableListHeight = availableViewportHeight - anchorBottomRelativeToContent;
// The suggestions should consume all available space in Modern on phone. // The suggestions should consume all available space in Modern on phone.
int desiredHeight = !mEmbedder.isTablet() ? availableListHeight int desiredHeight = !mEmbedder.isTablet() ? availableListHeight
......
...@@ -9,7 +9,6 @@ import android.view.View; ...@@ -9,7 +9,6 @@ import android.view.View;
import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost; import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
/** /**
* An interface for outside packages to interact with ToolbarLayout. Other than for testing purposes * An interface for outside packages to interact with ToolbarLayout. Other than for testing purposes
...@@ -50,13 +49,6 @@ public interface Toolbar { ...@@ -50,13 +49,6 @@ public interface Toolbar {
*/ */
void setTextureCaptureMode(boolean textureMode); void setTextureCaptureMode(boolean textureMode);
/**
* Set the {@link BottomSheet} for triggering animations. This can be null if Chrome Home is
* disabled.
* @param sheet The {@link BottomSheet}.
*/
void setBottomSheet(BottomSheet sheet);
/** /**
* @return Whether a dirty check for invalidation makes sense at this time. * @return Whether a dirty check for invalidation makes sense at this time.
*/ */
......
...@@ -46,7 +46,6 @@ import org.chromium.chrome.browser.util.ViewUtils; ...@@ -46,7 +46,6 @@ import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.PulseDrawable; import org.chromium.chrome.browser.widget.PulseDrawable;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.ToolbarProgressBar; import org.chromium.chrome.browser.widget.ToolbarProgressBar;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.components.security_state.ConnectionSecurityLevel;
import org.chromium.ui.UiUtils; import org.chromium.ui.UiUtils;
...@@ -971,9 +970,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -971,9 +970,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
mMenuButtonWrapper.updateContentDescription(); mMenuButtonWrapper.updateContentDescription();
} }
@Override
public void setBottomSheet(BottomSheet sheet) {}
/** /**
* Sets the current TabModelSelector so the toolbar can pass it into buttons that need access to * Sets the current TabModelSelector so the toolbar can pass it into buttons that need access to
* it. * it.
......
...@@ -240,7 +240,7 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -240,7 +240,7 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
mActivity = activity; mActivity = activity;
mActionBarDelegate = new ViewShiftingActionBarDelegate(activity, controlContainer); mActionBarDelegate = new ViewShiftingActionBarDelegate(activity, controlContainer);
mToolbarModel = new ToolbarModel(activity, activity.getBottomSheet()); mToolbarModel = new ToolbarModel(activity);
mControlContainer = controlContainer; mControlContainer = controlContainer;
assert mControlContainer != null; assert mControlContainer != null;
mUrlFocusChangedCallback = urlFocusChangedCallback; mUrlFocusChangedCallback = urlFocusChangedCallback;
...@@ -271,9 +271,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -271,9 +271,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
setMenuDelegatePhone(menuDelegate); setMenuDelegatePhone(menuDelegate);
toolbar.setPaintInvalidator(invalidator); toolbar.setPaintInvalidator(invalidator);
if (mActivity.getBottomSheet() != null) {
toolbar.setBottomSheet(mActivity.getBottomSheet());
}
mActionModeController.setTabStripHeight(toolbar.getTabStripHeight()); mActionModeController.setTabStripHeight(toolbar.getTabStripHeight());
mLocationBar = mToolbar.getLocationBar(); mLocationBar = mToolbar.getLocationBar();
mLocationBar.setToolbarDataProvider(mToolbarModel); mLocationBar.setToolbarDataProvider(mToolbarModel);
......
...@@ -32,7 +32,6 @@ import org.chromium.chrome.browser.profiles.Profile; ...@@ -32,7 +32,6 @@ import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.util.UrlUtilities; import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.components.dom_distiller.core.DomDistillerService; import org.chromium.components.dom_distiller.core.DomDistillerService;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.components.security_state.ConnectionSecurityLevel;
...@@ -47,7 +46,6 @@ import java.net.URISyntaxException; ...@@ -47,7 +46,6 @@ import java.net.URISyntaxException;
*/ */
public class ToolbarModel implements ToolbarDataProvider { public class ToolbarModel implements ToolbarDataProvider {
private final Context mContext; private final Context mContext;
private final BottomSheet mBottomSheet;
private Tab mTab; private Tab mTab;
private boolean mIsIncognito; private boolean mIsIncognito;
...@@ -59,11 +57,9 @@ public class ToolbarModel implements ToolbarDataProvider { ...@@ -59,11 +57,9 @@ public class ToolbarModel implements ToolbarDataProvider {
/** /**
* Default constructor for this class. * Default constructor for this class.
* @param context The Context used for styling the toolbar visuals. * @param context The Context used for styling the toolbar visuals.
* @param bottomSheet The {@link BottomSheet} for the activity displaying this toolbar.
*/ */
public ToolbarModel(Context context, @Nullable BottomSheet bottomSheet) { public ToolbarModel(Context context) {
mContext = context; mContext = context;
mBottomSheet = bottomSheet;
mPrimaryColor = ColorUtils.getDefaultThemeColor(context.getResources(), false); mPrimaryColor = ColorUtils.getDefaultThemeColor(context.getResources(), false);
} }
...@@ -303,7 +299,7 @@ public class ToolbarModel implements ToolbarDataProvider { ...@@ -303,7 +299,7 @@ public class ToolbarModel implements ToolbarDataProvider {
@Override @Override
public boolean isUsingBrandColor() { public boolean isUsingBrandColor() {
return mIsUsingBrandColor && mBottomSheet == null; return mIsUsingBrandColor;
} }
@Override @Override
......
...@@ -67,7 +67,7 @@ public class LocationBarLayoutTest { ...@@ -67,7 +67,7 @@ public class LocationBarLayoutTest {
private Integer mSecurityLevel; private Integer mSecurityLevel;
public TestToolbarModel() { public TestToolbarModel() {
super(ContextUtils.getApplicationContext(), null /* bottomSheet */); super(ContextUtils.getApplicationContext());
initializeWithNative(); initializeWithNative();
} }
......
...@@ -118,7 +118,7 @@ public class ToolbarModelTest { ...@@ -118,7 +118,7 @@ public class ToolbarModelTest {
private String mUrl; private String mUrl;
public TestToolbarModel() { public TestToolbarModel() {
super(ContextUtils.getApplicationContext(), null /* bottomSheet */); super(ContextUtils.getApplicationContext());
initializeWithNative(); initializeWithNative();
Tab tab = new Tab(0, false, null) { Tab tab = new Tab(0, false, null) {
......
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