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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java

Issue 2199413003: Make WebAPK use "start URL longest path" as the scope if the scope is missing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl2_scope Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698