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

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

Issue 1989283002: Upstream: Launch WebApkActivity from WebAPK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 4 years, 7 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 a0ae0609acec202b5623ebc62e0f88fc10c38d2d..fc4c5952cbbc7eb127c45247622fec5bac7d527c 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
@@ -32,6 +32,7 @@ public class WebappInfo {
private long mThemeColor;
private long mBackgroundColor;
private boolean mIsIconGenerated;
+ private String mWebApkPackageName;
public static WebappInfo createEmpty() {
return new WebappInfo();
@@ -80,9 +81,11 @@ public class WebappInfo {
String name = nameFromIntent(intent);
String shortName = shortNameFromIntent(intent);
+ String webApkPackageName = IntentUtils.safeGetStringExtra(intent,
+ ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME);
return create(id, url, icon, name, shortName, displayMode, orientation, source,
- themeColor, backgroundColor, isIconGenerated);
+ themeColor, backgroundColor, isIconGenerated, webApkPackageName);
}
/**
@@ -97,10 +100,12 @@ public class WebappInfo {
* @param source Source where the webapp was added from.
* @param themeColor The theme color of the webapp.
* @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.
*/
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) {
+ long backgroundColor, boolean isIconGenerated, String webApkPackageName) {
if (id == null || url == null) {
Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url);
return null;
@@ -108,12 +113,12 @@ public class WebappInfo {
Uri uri = Uri.parse(url);
return new WebappInfo(id, uri, icon, name, shortName, displayMode, orientation, source,
- themeColor, backgroundColor, isIconGenerated);
+ themeColor, backgroundColor, isIconGenerated, webApkPackageName);
}
private WebappInfo(String id, Uri uri, String encodedIcon, String name, String shortName,
int displayMode, int orientation, int source, long themeColor,
- long backgroundColor, boolean isIconGenerated) {
+ long backgroundColor, boolean isIconGenerated, String webApkPackageName) {
mEncodedIcon = encodedIcon;
mId = id;
mName = name;
@@ -126,6 +131,7 @@ public class WebappInfo {
mBackgroundColor = backgroundColor;
mIsIconGenerated = isIconGenerated;
mIsInitialized = mUri != null;
+ mWebApkPackageName = webApkPackageName;
}
private WebappInfo() {
@@ -155,6 +161,10 @@ public class WebappInfo {
return mDisplayMode;
}
+ public String webApkPackageName() {
+ return mWebApkPackageName;
+ }
+
public int orientation() {
return mOrientation;
}
@@ -246,6 +256,9 @@ public class WebappInfo {
intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, themeColor());
intent.putExtra(ShortcutHelper.EXTRA_BACKGROUND_COLOR, backgroundColor());
intent.putExtra(ShortcutHelper.EXTRA_IS_ICON_GENERATED, isIconGenerated());
+ if (webApkPackageName() != null) {
+ intent.putExtra(ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME, webApkPackageName());
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698