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

Unified Diff: chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java

Issue 2956193002: [Android] Enable WebAPK to have multiple intent filters (Closed)
Patch Set: Merge branch 'master' into rewriting Created 3 years, 5 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/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);
« no previous file with comments | « chrome/android/webapk/shell_apk/shell_apk_version.gni ('k') | chrome/android/webapk/shell_apk/unbound_manifest_config.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698