| 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 022ec47182d32868246816a4dbc291e774f49966..936279dd595f5887c23ef20d07d17be46255304f 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| @@ -511,13 +511,17 @@ public class ShortcutHelper {
|
| }
|
|
|
| /**
|
| - * 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 "/".
|
| + * Generates a scope URL based on the passed in URL. It should be used if the Web Manifest
|
| + * does not specify a scope URL.
|
| * @param url The url to convert to a scope.
|
| * @return The scope.
|
| */
|
| + @CalledByNative
|
| public static String getScopeFromUrl(String url) {
|
| + // Scope URL is generated by:
|
| + // - Removing last component of the URL.
|
| + // - Clearing the URL's query and fragment.
|
| +
|
| Uri uri = Uri.parse(url);
|
| List<String> path = uri.getPathSegments();
|
| int endIndex = path.size();
|
| @@ -535,7 +539,6 @@ public class ShortcutHelper {
|
| }
|
| builder.path(scope_path);
|
|
|
| - // Clear out the query and fragment.
|
| builder.fragment("");
|
| builder.query("");
|
| return builder.build().toString();
|
|
|