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

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

Issue 1420743002: Web app: set a flag on the Intent if the icon was generated by Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@splashscreen-even-more-tests
Patch Set: review comments Created 5 years, 2 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 2c60f386d6554f018216a16c57b556b7b26c68b6..c34b6e39434ce8f9d05b9b90f37f89015e352aa8 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
@@ -29,6 +29,7 @@ public class WebappInfo {
private int mSource;
private long mThemeColor;
private long mBackgroundColor;
+ private boolean mIsIconGenerated;
public static WebappInfo createEmpty() {
return new WebappInfo();
@@ -70,12 +71,14 @@ public class WebappInfo {
long backgroundColor = IntentUtils.safeGetLongExtra(intent,
ShortcutHelper.EXTRA_BACKGROUND_COLOR,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
+ boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent,
+ ShortcutHelper.EXTRA_IS_ICON_GENERATED, false);
String name = nameFromIntent(intent);
String shortName = shortNameFromIntent(intent);
return create(id, url, icon, name, shortName, orientation, source,
- themeColor, backgroundColor);
+ themeColor, backgroundColor, isIconGenerated);
}
/**
@@ -88,10 +91,11 @@ public class WebappInfo {
* @param orientation Orientation of the webapp.
* @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.
*/
public static WebappInfo create(String id, String url, String icon, String name,
String shortName, int orientation, int source, long themeColor,
- long backgroundColor) {
+ long backgroundColor, boolean isIconGenerated) {
if (id == null || url == null) {
Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url);
return null;
@@ -99,12 +103,12 @@ public class WebappInfo {
Uri uri = Uri.parse(url);
return new WebappInfo(id, uri, icon, name, shortName, orientation, source,
- themeColor, backgroundColor);
+ themeColor, backgroundColor, isIconGenerated);
}
private WebappInfo(String id, Uri uri, String encodedIcon, String name,
String shortName, int orientation, int source, long themeColor,
- long backgroundColor) {
+ long backgroundColor, boolean isIconGenerated) {
mEncodedIcon = encodedIcon;
mId = id;
mName = name;
@@ -114,6 +118,7 @@ public class WebappInfo {
mSource = source;
mThemeColor = themeColor;
mBackgroundColor = backgroundColor;
+ mIsIconGenerated = isIconGenerated;
mIsInitialized = mUri != null;
}
@@ -136,6 +141,7 @@ public class WebappInfo {
mSource = newInfo.mSource;
mThemeColor = newInfo.mThemeColor;
mBackgroundColor = newInfo.mBackgroundColor;
+ mIsIconGenerated = newInfo.mIsIconGenerated;
}
public boolean isInitialized() {
@@ -224,6 +230,13 @@ public class WebappInfo {
}
/**
+ * Returns whether the icon was generated by Chromium.
+ */
+ public boolean isIconGenerated() {
+ return mIsIconGenerated;
+ }
+
+ /**
* Sets extras on an Intent that will launch a WebappActivity.
* @param intent Intent that will be used to launch a WebappActivity.
*/
@@ -237,5 +250,6 @@ public class WebappInfo {
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, source());
intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, themeColor());
intent.putExtra(ShortcutHelper.EXTRA_BACKGROUND_COLOR, backgroundColor());
+ intent.putExtra(ShortcutHelper.EXTRA_IS_ICON_GENERATED, isIconGenerated());
}
}

Powered by Google App Engine
This is Rietveld 408576698