| 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..23eb86177532c91c09c56d0fb05c98eb103cb227 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.
|
| + 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())
|
| + .encodedAuthority(parsedScope.getEncodedAuthority())
|
| + .build()
|
| + .toString();
|
| + }
|
| +
|
| Log.v(TAG, "Url of the WebAPK: " + mStartUrl);
|
| String packageName = getPackageName();
|
| Log.v(TAG, "Package name of the WebAPK:" + packageName);
|
|
|