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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java

Issue 2956193002: [Android] Enable WebAPK to have multiple intent filters (Closed)
Patch Set: Merge branch 'mustache' into rewriting Created 3 years, 6 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/webapps/WebApkInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java
index 70892c7c158d756086b6b4cbd4d965f8a015d4ef..ed20ee3d43cedd7bd8860e0a5161fd89cf293cca 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java
@@ -10,6 +10,7 @@ import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
@@ -186,6 +187,17 @@ public class WebApkInfo extends WebappInfo {
scope = ShortcutHelper.getScopeFromUrl(manifestStartUrl);
}
+ // The WebAPK may have been launched as a result of an intent filter for a different scheme
+ // or top level domain. Rewrite the scheme and host name to the scope's scheme and host
+ // name.
palmer 2017/06/28 21:24:40 This is where the rubber hits the road, right? How
pkotwicz 2017/06/28 22:26:21 I think that Yaron was asking whether doing the UR
Yaron 2017/06/29 02:15:07 Yes, that was one part. It sounds like it's safe.
Yaron 2017/07/10 23:39:35 So playing this out - what happens if you're in a
pkotwicz 2017/07/11 14:31:38 The goal of the URL rewriting is to enable a web a
Yaron 2017/07/12 16:54:01 Not sure that's really desirable.
+ Uri parsedUrl = Uri.parse(url);
+ Uri parsedScope = Uri.parse(scope);
+ url = parsedUrl.buildUpon()
+ .scheme(parsedScope.getScheme())
+ .authority(parsedScope.getAuthority())
+ .build()
+ .toString();
+
return new WebApkInfo(id, url, forceNavigation, scope, primaryIcon, badgeIcon, name,
shortName, displayMode, orientation, source, themeColor, backgroundColor,
webApkPackageName, shellApkVersion, manifestUrl, manifestStartUrl,

Powered by Google App Engine
This is Rietveld 408576698