| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
|
| index deb5911005d56d378f5e6a71c9bf1e2bfd76e01f..d13cc6767557a25d00dff61dedb0c2beb0d412dc 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
|
| @@ -26,6 +26,7 @@ public class WebappInfo {
|
| private String mEncodedIcon;
|
| private Bitmap mDecodedIcon;
|
| private Uri mUri;
|
| + private Uri mScopeUri;
|
| private String mName;
|
| private String mShortName;
|
| private int mDisplayMode;
|
| @@ -123,6 +124,7 @@ public class WebappInfo {
|
| String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ID);
|
| String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON);
|
| String url = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_URL);
|
| + String scope = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_SCOPE);
|
| int displayMode = displayModeFromIntent(intent);
|
| int orientation = orientationFromIntent(intent);
|
| int source = IntentUtils.safeGetIntExtra(intent,
|
| @@ -143,7 +145,7 @@ public class WebappInfo {
|
| String webManifestUrl = IntentUtils.safeGetStringExtra(intent,
|
| ShortcutHelper.EXTRA_WEB_MANIFEST_URL);
|
|
|
| - return create(id, url, icon, name, shortName, displayMode, orientation, source,
|
| + return create(id, url, scope, icon, name, shortName, displayMode, orientation, source,
|
| themeColor, backgroundColor, isIconGenerated, webApkPackageName, webManifestUrl);
|
| }
|
|
|
| @@ -151,6 +153,7 @@ public class WebappInfo {
|
| * Construct a WebappInfo.
|
| * @param id ID for the webapp.
|
| * @param url URL for the webapp.
|
| + * @param scope Scope for the webapp.
|
| * @param icon Icon to show for the webapp.
|
| * @param name Name of the webapp.
|
| * @param shortName The short name of the webapp.
|
| @@ -163,7 +166,7 @@ public class WebappInfo {
|
| * no WebAPK is associated with the webapp.
|
| * @param webManifestUrl The URL of the Web Manifest.
|
| */
|
| - public static WebappInfo create(String id, String url, String icon, String name,
|
| + public static WebappInfo create(String id, String url, String scope, String icon, String name,
|
| String shortName, int displayMode, int orientation, int source, long themeColor,
|
| long backgroundColor, boolean isIconGenerated, String webApkPackageName,
|
| String webManifestUrl) {
|
| @@ -173,16 +176,21 @@ public class WebappInfo {
|
| }
|
|
|
| Uri uri = Uri.parse(url);
|
| + if (scope == null || scope.isEmpty()) {
|
| + scope = ShortcutHelper.getScopeFromUrl(url);
|
| + }
|
| + Uri scopeUri = Uri.parse(scope);
|
| Uri webManifestUri = null;
|
| if (!TextUtils.isEmpty(webManifestUrl)) {
|
| webManifestUri = Uri.parse(webManifestUrl);
|
| }
|
| - return new WebappInfo(id, uri, icon, name, shortName, displayMode, orientation, source,
|
| - themeColor, backgroundColor, isIconGenerated, webApkPackageName, webManifestUri);
|
| + return new WebappInfo(id, uri, scopeUri, icon, name, shortName, displayMode, orientation,
|
| + source, themeColor, backgroundColor, isIconGenerated, webApkPackageName,
|
| + webManifestUri);
|
| }
|
|
|
| - private WebappInfo(String id, Uri uri, String encodedIcon, String name, String shortName,
|
| - int displayMode, int orientation, int source, long themeColor,
|
| + private WebappInfo(String id, Uri uri, Uri scopeUri, String encodedIcon, String name,
|
| + String shortName, int displayMode, int orientation, int source, long themeColor,
|
| long backgroundColor, boolean isIconGenerated, String webApkPackageName,
|
| Uri webManifestUri) {
|
| mEncodedIcon = encodedIcon;
|
| @@ -190,6 +198,7 @@ public class WebappInfo {
|
| mName = name;
|
| mShortName = shortName;
|
| mUri = uri;
|
| + mScopeUri = scopeUri;
|
| mDisplayMode = displayMode;
|
| mOrientation = orientation;
|
| mSource = source;
|
| @@ -216,6 +225,10 @@ public class WebappInfo {
|
| return mUri;
|
| }
|
|
|
| + public Uri scopeUri() {
|
| + return mScopeUri;
|
| + }
|
| +
|
| public String name() {
|
| return mName;
|
| }
|
| @@ -322,8 +335,7 @@ public class WebappInfo {
|
| public void setWebappIntentExtras(Intent intent) {
|
| intent.putExtra(ShortcutHelper.EXTRA_ID, id());
|
| intent.putExtra(ShortcutHelper.EXTRA_URL, uri().toString());
|
| - intent.putExtra(ShortcutHelper.EXTRA_SCOPE,
|
| - ShortcutHelper.getScopeFromUrl(uri().toString()));
|
| + intent.putExtra(ShortcutHelper.EXTRA_SCOPE, scopeUri().toString());
|
| intent.putExtra(ShortcutHelper.EXTRA_ICON, encodedIcon());
|
| intent.putExtra(ShortcutHelper.EXTRA_VERSION, ShortcutHelper.WEBAPP_SHORTCUT_VERSION);
|
| intent.putExtra(ShortcutHelper.EXTRA_NAME, name());
|
|
|