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, |