Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4305)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java

Issue 2005053002: WebAPKs: Open links which are outside of WebAPK scope in Chrome not in WebAPK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698