| Index: chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
|
| index f720732fb475fb45fd2f1fc655fde1ef59cc2e62..8cb6a121b608d71999878be8750feb9f05f6971e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
|
| @@ -392,11 +392,11 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
| }
|
|
|
| @Override
|
| - public int loadUrl(LoadUrlParams params) {
|
| + public int loadUrl(LoadUrlParams params, boolean incognito) {
|
| for (BottomSheetObserver o : mObservers) o.onLoadUrl(params.getUrl());
|
|
|
| // Native page URLs in this context do not need to communicate with the tab.
|
| - if (NativePageFactory.isNativePageUrl(params.getUrl(), isIncognito())) {
|
| + if (NativePageFactory.isNativePageUrl(params.getUrl(), incognito)) {
|
| return TabLoadStatus.PAGE_LOAD_FAILED;
|
| }
|
|
|
| @@ -406,13 +406,13 @@ public int loadUrl(LoadUrlParams params) {
|
| assert mTabModelSelector != null;
|
|
|
| // First try to get the tab behind the sheet.
|
| - if (mTabModelSelector.getCurrentTab() != null) {
|
| - return mTabModelSelector.getCurrentTab().loadUrl(params);
|
| + if (getActiveTab() != null && getActiveTab().isIncognito() == incognito) {
|
| + return getActiveTab().loadUrl(params);
|
| }
|
|
|
| - // If no tab is active behind the sheet, open a new one.
|
| + // If no compatible tab is active behind the sheet, open a new one.
|
| mTabModelSelector.openNewTab(
|
| - params, TabModel.TabLaunchType.FROM_CHROME_UI, null, isIncognito());
|
| + params, TabModel.TabLaunchType.FROM_CHROME_UI, getActiveTab(), incognito);
|
| return TabLoadStatus.DEFAULT_PAGE_LOAD;
|
| }
|
|
|
|
|