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

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

Issue 2070433002: Use scope defined in Web Manifest when adding page to homescreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_scope Created 4 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
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.cc » ('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 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.
*/
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698