| Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
|
| index 7303e9e6af1e3edc1a8d3b339db41fd27417c11a..1a729c4705873adec40ba476aa6df8a45325c63d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
|
| @@ -146,15 +146,18 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| }
|
| }
|
|
|
| - private CustomTabNavigationDelegate mNavigationDelegate;
|
| + private final boolean mShouldHideTopControls;
|
| + private final boolean mIsOpenedByChrome;
|
| +
|
| + private ExternalNavigationDelegateImpl mNavigationDelegate;
|
| private ExternalNavigationHandler mNavigationHandler;
|
| - private boolean mShouldHideTopControls;
|
|
|
| /**
|
| * @param shouldHideTopControls Whether or not the top controls may auto-hide.
|
| */
|
| - public CustomTabDelegateFactory(boolean shouldHideTopControls) {
|
| + public CustomTabDelegateFactory(boolean shouldHideTopControls, boolean isOpenedByChrome) {
|
| mShouldHideTopControls = shouldHideTopControls;
|
| + mIsOpenedByChrome = isOpenedByChrome;
|
| }
|
|
|
| @Override
|
| @@ -174,7 +177,11 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
|
|
| @Override
|
| public InterceptNavigationDelegateImpl createInterceptNavigationDelegate(Tab tab) {
|
| - mNavigationDelegate = new CustomTabNavigationDelegate(tab, tab.getAppAssociatedWith());
|
| + if (mIsOpenedByChrome) {
|
| + mNavigationDelegate = new ExternalNavigationDelegateImpl(tab);
|
| + } else {
|
| + mNavigationDelegate = new CustomTabNavigationDelegate(tab, tab.getAppAssociatedWith());
|
| + }
|
| mNavigationHandler = new ExternalNavigationHandler(mNavigationDelegate);
|
| return new InterceptNavigationDelegateImpl(mNavigationHandler, tab);
|
| }
|
| @@ -197,7 +204,7 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| * @return The {@link CustomTabNavigationDelegate} in this tab. For test purpose only.
|
| */
|
| @VisibleForTesting
|
| - CustomTabNavigationDelegate getExternalNavigationDelegate() {
|
| + ExternalNavigationDelegateImpl getExternalNavigationDelegate() {
|
| return mNavigationDelegate;
|
| }
|
|
|
|
|