Index: chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java |
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java |
index 968e7bdb404b5e5be06e4b1b2045e29b747e809e..adf9906a7d9bed2c0f5ee745834b9a903538ea32 100644 |
--- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java |
+++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java |
@@ -90,6 +90,20 @@ public class MainActivity extends Activity { |
return; |
} |
+ // 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. |
Yaron
2017/07/24 15:09:18
nit: there's an extra space in there :)
|
+ String scopeUrl = metadata.getString(WebApkMetaDataKeys.SCOPE); |
+ if (!TextUtils.isEmpty(scopeUrl)) { |
+ Uri parsedStartUrl = Uri.parse(mStartUrl); |
+ Uri parsedScope = Uri.parse(scopeUrl); |
+ mStartUrl = parsedStartUrl.buildUpon() |
+ .scheme(parsedScope.getScheme()) |
+ .authority(parsedScope.getAuthority()) |
+ .build() |
+ .toString(); |
+ } |
+ |
Log.v(TAG, "Url of the WebAPK: " + mStartUrl); |
String packageName = getPackageName(); |
Log.v(TAG, "Package name of the WebAPK:" + packageName); |