| 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 459c7575a042d420d9375cd0165a70d493667e8d..7b2aa00539a4f369bab1dbc40e7a79cc78f27d89 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
|
| @@ -10,7 +10,6 @@ import android.os.TransactionTooLargeException;
|
|
|
| import org.chromium.base.Log;
|
| import org.chromium.base.VisibleForTesting;
|
| -import org.chromium.chrome.browser.ChromeActivity;
|
| import org.chromium.chrome.browser.banners.AppBannerManager;
|
| import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator;
|
| import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator;
|
| @@ -39,8 +38,8 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| /**
|
| * Constructs a new instance of {@link CustomTabNavigationDelegate}.
|
| */
|
| - public CustomTabNavigationDelegate(ChromeActivity activity, String clientPackageName) {
|
| - super(activity);
|
| + public CustomTabNavigationDelegate(Tab tab, String clientPackageName) {
|
| + super(tab);
|
| mClientPackageName = clientPackageName;
|
| }
|
|
|
| @@ -57,14 +56,15 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| try {
|
| // For a URL chrome can handle and there is no default set, handle it ourselves.
|
| if (!hasDefaultHandler) {
|
| - if (isPackageSpecializedHandler(getActivity(), mClientPackageName, intent)) {
|
| + if (isPackageSpecializedHandler(
|
| + mApplicationContext, mClientPackageName, intent)) {
|
| intent.setPackage(mClientPackageName);
|
| } else if (!isExternalProtocol) {
|
| return false;
|
| }
|
| }
|
| // If android fails to find a handler, handle it ourselves.
|
| - if (!getActivity().startActivityIfNeeded(intent, -1)) return false;
|
| + if (!startActivityIfNeeded(intent)) return false;
|
|
|
| mHasActivityStarted = true;
|
| return true;
|
| @@ -81,9 +81,10 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| */
|
| private boolean hasDefaultHandler(Intent intent) {
|
| try {
|
| - ResolveInfo info = getActivity().getPackageManager().resolveActivity(intent, 0);
|
| + ResolveInfo info =
|
| + mApplicationContext.getPackageManager().resolveActivity(intent, 0);
|
| if (info != null) {
|
| - final String chromePackage = getActivity().getPackageName();
|
| + final String chromePackage = mApplicationContext.getPackageName();
|
| // If a default handler is found and it is not chrome itself, fire the intent.
|
| if (info.match != 0 && !chromePackage.equals(info.activityInfo.packageName)) {
|
| return true;
|
| @@ -141,11 +142,10 @@ public class CustomTabDelegateFactory extends TabDelegateFactory {
|
| }
|
|
|
| @Override
|
| - public InterceptNavigationDelegateImpl createInterceptNavigationDelegate(Tab tab,
|
| - ChromeActivity activity) {
|
| - mNavigationDelegate = new CustomTabNavigationDelegate(activity, tab.getAppAssociatedWith());
|
| + public InterceptNavigationDelegateImpl createInterceptNavigationDelegate(Tab tab) {
|
| + mNavigationDelegate = new CustomTabNavigationDelegate(tab, tab.getAppAssociatedWith());
|
| mNavigationHandler = new ExternalNavigationHandler(mNavigationDelegate);
|
| - return new InterceptNavigationDelegateImpl(mNavigationHandler, activity, tab);
|
| + return new InterceptNavigationDelegateImpl(mNavigationHandler, tab);
|
| }
|
|
|
| @Override
|
|
|