| Index: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| index eccfd16e4b410642453111e2b3bd04aaf9196db3..4d5ea8f2267f128d9ecf28502f4bb809a306917b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| @@ -140,10 +140,10 @@ public class ShortcutHelper {
|
| */
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| - private static void addShortcut(String id, String url, final String userTitle, String name,
|
| - String shortName, String iconUrl, Bitmap icon, int displayMode, int orientation,
|
| - int source, long themeColor, long backgroundColor, String manifestUrl,
|
| - final long callbackPointer) {
|
| + private static void addShortcut(String id, String url, String scopeUrl,
|
| + final String userTitle, String name, String shortName, String iconUrl, Bitmap icon,
|
| + int displayMode, int orientation, int source, long themeColor, long backgroundColor,
|
| + String manifestUrl, final long callbackPointer) {
|
| assert !ThreadUtils.runningOnUiThread();
|
|
|
| Context context = ContextUtils.getApplicationContext();
|
| @@ -154,15 +154,20 @@ public class ShortcutHelper {
|
| if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_WEBAPK)) {
|
| WebApkBuilder apkBuilder = ((ChromeApplication) context).createWebApkBuilder();
|
| if (apkBuilder != null) {
|
| - apkBuilder.buildWebApkAsync(url, GURLUtils.getOrigin(url), name, shortName,
|
| - iconUrl, icon, displayMode, orientation, themeColor, backgroundColor,
|
| - manifestUrl);
|
| + if (TextUtils.isEmpty(scopeUrl)) {
|
| + scopeUrl = GURLUtils.getOrigin(url);
|
| + }
|
| + apkBuilder.buildWebApkAsync(url, scopeUrl, name, shortName, iconUrl, icon,
|
| + displayMode, orientation, themeColor, backgroundColor, manifestUrl);
|
| return;
|
| }
|
| }
|
| + if (TextUtils.isEmpty(scopeUrl)) {
|
| + scopeUrl = getScopeFromUrl(url);
|
| + }
|
| shortcutIntent = createWebappShortcutIntent(id, sDelegate.getFullscreenAction(), url,
|
| - getScopeFromUrl(url), name, shortName, icon, WEBAPP_SHORTCUT_VERSION,
|
| - displayMode, orientation, themeColor, backgroundColor, iconUrl.isEmpty());
|
| + scopeUrl, name, shortName, icon, WEBAPP_SHORTCUT_VERSION, displayMode,
|
| + orientation, themeColor, backgroundColor, iconUrl.isEmpty());
|
| shortcutIntent.putExtra(EXTRA_MAC, getEncodedMac(context, url));
|
| } else {
|
| // Add the shortcut as a launcher icon to open in the browser Activity.
|
| @@ -511,9 +516,9 @@ public class ShortcutHelper {
|
| }
|
|
|
| /**
|
| - * Returns the URL with all but the last component of its path removed. This serves as a proxy
|
| - * for scope until the scope manifest member is available. This method assumes that the URL
|
| - * passed in is a valid URL with a path that contains at least one "/".
|
| + * Returns the URL with all but the last component of its path removed. This is used if the
|
| + * Web Manifest does not specify a scope. This method assumes that the URL passed in is a
|
| + * valid URL with a path that contains at least one "/".
|
| * @param url The url to convert to a scope.
|
| * @return The scope.
|
| */
|
|
|