| Index: chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
|
| index 83bead5f9bfc6521e4aa9fac117ec269c8290342..868a262236be90382f789227c334ab1bde19e15e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
|
| @@ -517,13 +517,6 @@ public class BottomSheet
|
| }
|
|
|
| mNtpController.setTabModelSelector(tabModelSelector);
|
| -
|
| - mTabModelSelector.addObserver(new EmptyTabModelSelectorObserver() {
|
| - @Override
|
| - public void onTabModelSelected(TabModel newModel, TabModel oldModel) {
|
| - setSheetState(SHEET_STATE_PEEK, true);
|
| - }
|
| - });
|
| }
|
|
|
| /**
|
| @@ -645,21 +638,24 @@ public class BottomSheet
|
| return TabLoadStatus.PAGE_LOAD_FAILED;
|
| }
|
|
|
| - // In all non-native cases, minimize the sheet.
|
| - mMetrics.setSheetCloseReason(BottomSheetMetrics.CLOSED_BY_NAVIGATION);
|
| - setSheetState(SHEET_STATE_PEEK, true);
|
| -
|
| assert mTabModelSelector != null;
|
|
|
| + int tabLoadStatus = TabLoadStatus.DEFAULT_PAGE_LOAD;
|
| +
|
| // First try to get the tab behind the sheet.
|
| if (!isShowingNtp && getActiveTab() != null && getActiveTab().isIncognito() == incognito) {
|
| - return getActiveTab().loadUrl(params);
|
| + tabLoadStatus = getActiveTab().loadUrl(params);
|
| + } else {
|
| + // If no compatible tab is active behind the sheet, open a new one.
|
| + mTabModelSelector.openNewTab(
|
| + params, TabModel.TabLaunchType.FROM_CHROME_UI, getActiveTab(), incognito);
|
| }
|
|
|
| - // If no compatible tab is active behind the sheet, open a new one.
|
| - mTabModelSelector.openNewTab(
|
| - params, TabModel.TabLaunchType.FROM_CHROME_UI, getActiveTab(), incognito);
|
| - return TabLoadStatus.DEFAULT_PAGE_LOAD;
|
| + // In all non-native cases, minimize the sheet.
|
| + mMetrics.setSheetCloseReason(BottomSheetMetrics.CLOSED_BY_NAVIGATION);
|
| + setSheetState(SHEET_STATE_PEEK, true);
|
| +
|
| + return tabLoadStatus;
|
| }
|
|
|
| /**
|
| @@ -673,13 +669,6 @@ public class BottomSheet
|
| loadUrl(params, mTabModelSelector.isIncognitoSelected());
|
| }
|
|
|
| - /**
|
| - * Called when the activity containing the {@link BottomSheet} processes a url view intent.
|
| - */
|
| - public void onProcessUrlViewIntent() {
|
| - mNtpController.onProcessUrlViewIntent();
|
| - }
|
| -
|
| @Override
|
| public boolean isIncognito() {
|
| if (getActiveTab() == null) return false;
|
| @@ -693,7 +682,7 @@ public class BottomSheet
|
|
|
| @Override
|
| public Tab getActiveTab() {
|
| - return mTabModelSelector == null || mNtpController.isShowingNewTab()
|
| + return mTabModelSelector == null || mNtpController.isShowingNewTabUi()
|
| ? null
|
| : mTabModelSelector.getCurrentTab();
|
| }
|
| @@ -1223,7 +1212,7 @@ public class BottomSheet
|
| * returns true if a normal or incognito new tab is showing.
|
| */
|
| public boolean isShowingNewTab() {
|
| - return mNtpController.isShowingNewTab();
|
| + return mNtpController.isShowingNewTabUi();
|
| }
|
|
|
| /**
|
| @@ -1253,7 +1242,7 @@ public class BottomSheet
|
| mFindInPageView != null && mFindInPageView.getVisibility() == View.VISIBLE;
|
|
|
| return !isToolbarAndroidViewHidden()
|
| - && (!isInOverviewMode || mNtpController.isShowingNewTab()) && !isFindInPageVisible
|
| + && (!isInOverviewMode || mNtpController.isShowingNewTabUi()) && !isFindInPageVisible
|
| && !blockPeekingSwipes;
|
| }
|
|
|
|
|