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

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

Issue 2140273002: Add web_manifest_url in WebappInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. 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
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 629b0743940866871ec9a4ba9eaad0606a0a6bba..deb5911005d56d378f5e6a71c9bf1e2bfd76e01f 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
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.webapps;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
+import android.text.TextUtils;
import android.util.Log;
import org.chromium.blink_public.platform.WebDisplayMode;
@@ -34,6 +35,11 @@ public class WebappInfo {
private long mBackgroundColor;
private boolean mIsIconGenerated;
private String mWebApkPackageName;
+ /**
+ * The Web Manifest URL lives in a WebAPK AndroidManifest and WebappInfo, not in
+ * WebappDataStorage.
+ */
+ private Uri mWebManifestUri;
public static WebappInfo createEmpty() {
return new WebappInfo();
@@ -134,9 +140,11 @@ public class WebappInfo {
String shortName = shortNameFromIntent(intent);
String webApkPackageName = IntentUtils.safeGetStringExtra(intent,
ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME);
+ String webManifestUrl = IntentUtils.safeGetStringExtra(intent,
+ ShortcutHelper.EXTRA_WEB_MANIFEST_URL);
return create(id, url, icon, name, shortName, displayMode, orientation, source,
- themeColor, backgroundColor, isIconGenerated, webApkPackageName);
+ themeColor, backgroundColor, isIconGenerated, webApkPackageName, webManifestUrl);
}
/**
@@ -153,23 +161,30 @@ public class WebappInfo {
* @param isIconGenerated Whether the |icon| was generated by Chromium.
* @param webApkPackageName The package of the WebAPK associated with the webapp. Null if
* 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,
String shortName, int displayMode, int orientation, int source, long themeColor,
- long backgroundColor, boolean isIconGenerated, String webApkPackageName) {
+ long backgroundColor, boolean isIconGenerated, String webApkPackageName,
+ String webManifestUrl) {
if (id == null || url == null) {
Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url);
return null;
}
Uri uri = Uri.parse(url);
+ 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);
+ 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,
- long backgroundColor, boolean isIconGenerated, String webApkPackageName) {
+ long backgroundColor, boolean isIconGenerated, String webApkPackageName,
+ Uri webManifestUri) {
mEncodedIcon = encodedIcon;
mId = id;
mName = name;
@@ -183,6 +198,7 @@ public class WebappInfo {
mIsIconGenerated = isIconGenerated;
mIsInitialized = mUri != null;
mWebApkPackageName = webApkPackageName;
+ mWebManifestUri = webManifestUri;
}
private WebappInfo() {
@@ -296,6 +312,9 @@ public class WebappInfo {
return mIsIconGenerated;
}
+ public Uri webManifestUri() {
+ return mWebManifestUri;
+ }
/**
* Sets extras on an Intent that will launch a WebappActivity.
* @param intent Intent that will be used to launch a WebappActivity.
@@ -318,6 +337,9 @@ public class WebappInfo {
if (webApkPackageName() != null) {
intent.putExtra(ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME, webApkPackageName());
}
+ if (webManifestUri() != null) {
+ intent.putExtra(ShortcutHelper.EXTRA_WEB_MANIFEST_URL, webManifestUri().toString());
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698