Index: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
index bc10c7b14288dc0336b6ca6a20d6c411b894b74b..0b5b2923d369c19694d2b4976c6f9e4b7f879315 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
@@ -64,12 +64,12 @@ public class ExternalNavigationHandler { |
} |
/** |
- * A constructor for UrlHandler. |
- * |
- * @param tab The tab that initiated the external intent. |
+ * Creates {@link ExternalNavigationHandler} with default arguments. |
+ * @param tab The associated tab. |
+ * @return The ExternalNavigationHandler. |
*/ |
- public ExternalNavigationHandler(Tab tab) { |
- this(new ExternalNavigationDelegateImpl(tab)); |
+ public static ExternalNavigationHandler createDefault(Tab tab) { |
+ return new ExternalNavigationHandler(new ExternalNavigationDelegateImpl(tab, null)); |
} |
/** |
@@ -298,7 +298,7 @@ public class ExternalNavigationHandler { |
try { |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse( |
"market://details?id=" + packagename |
- + "&referrer=" + mDelegate.getPackageName())); |
+ + "&referrer=" + mDelegate.getBrowserPackageName())); |
intent.addCategory(Intent.CATEGORY_BROWSABLE); |
intent.setPackage("com.android.vending"); |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
@@ -328,7 +328,7 @@ public class ExternalNavigationHandler { |
// Set the Browser application ID to us in case the user chooses Chrome |
// as the app. This will make sure the link is opened in the same tab |
// instead of making a new one. |
- intent.putExtra(Browser.EXTRA_APPLICATION_ID, mDelegate.getPackageName()); |
+ intent.putExtra(Browser.EXTRA_APPLICATION_ID, mDelegate.getBrowserPackageName()); |
if (params.isOpenInNewTab()) intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
mDelegate.maybeSetWindowId(intent); |
@@ -342,6 +342,10 @@ public class ExternalNavigationHandler { |
// startActivityIfNeeded or startActivity. |
if (!isExternalProtocol) { |
if (!mDelegate.isSpecializedHandlerAvailable(resolvingInfos)) { |
+ if (mDelegate.getWebApkPackageName() != null) { |
+ mDelegate.startChromeActivity(params.getUrl()); |
+ return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT; |
+ } |
return OverrideUrlLoadingResult.NO_OVERRIDE; |
} else if (params.getReferrerUrl() != null && (isLink || isFormSubmit)) { |
// Current URL has at least one specialized handler available. For navigations |