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

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

Issue 1234653004: webapps: utilize manifest theme colors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mounir's comments Created 5 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 260b2553732a1a91db1ca4cc4c094d69fd08f582..7df51de699031864579464c7ceff1c7f679c56e7 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 String mTitle;
private int mOrientation;
private int mSource;
+ private long mThemeColor;
public static WebappInfo createEmpty() {
return new WebappInfo();
@@ -47,7 +48,9 @@ public class WebappInfo {
ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT);
int source = intent.getIntExtra(
ShortcutHelper.EXTRA_SOURCE, ShortcutHelper.SOURCE_UNKNOWN);
- return create(id, url, icon, title, orientation, source);
+ long themeColor = intent.getLongExtra(ShortcutHelper.EXTRA_THEME_COLOR,
+ ShortcutHelper.THEME_COLOR_INVALID_OR_MISSING);
+ return create(id, url, icon, title, orientation, source, themeColor);
}
/**
@@ -56,11 +59,12 @@ public class WebappInfo {
* @param url URL for the webapp.
* @param icon Icon to show for the webapp.
* @param title Title of the webapp.
+ * @param themeColor The theme color of the webapp.
* @param orientation Orientation of the webapp.
* @param source Source where the webapp was added from.
*/
public static WebappInfo create(String id, String url, String icon, String title,
- int orientation, int source) {
+ int orientation, int source, long themeColor) {
if (id == null || url == null) {
Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url);
return null;
@@ -73,16 +77,18 @@ public class WebappInfo {
}
Uri uri = Uri.parse(url);
- return new WebappInfo(id, uri, favicon, title, orientation, source);
+ return new WebappInfo(id, uri, favicon, title, orientation, source, themeColor);
}
- private WebappInfo(String id, Uri uri, Bitmap icon, String title, int orientation, int source) {
+ private WebappInfo(String id, Uri uri, Bitmap icon, String title,
+ int orientation, int source, long themeColor) {
mIcon = icon;
mId = id;
mTitle = title;
mUri = uri;
mOrientation = orientation;
mSource = source;
+ mThemeColor = themeColor;
mIsInitialized = mUri != null;
}
@@ -102,6 +108,7 @@ public class WebappInfo {
outState.putString(ShortcutHelper.EXTRA_TITLE, mTitle);
outState.putInt(ShortcutHelper.EXTRA_ORIENTATION, mOrientation);
outState.putInt(ShortcutHelper.EXTRA_SOURCE, mSource);
+ outState.putLong(ShortcutHelper.EXTRA_THEME_COLOR, mThemeColor);
}
/**
@@ -114,8 +121,10 @@ public class WebappInfo {
mId = newInfo.mId;
mUri = newInfo.mUri;
mTitle = newInfo.mTitle;
+ mThemeColor = newInfo.mThemeColor;
mOrientation = newInfo.mOrientation;
mSource = newInfo.mSource;
+ mThemeColor = newInfo.mThemeColor;
mlamouri (slow - plz ping) 2015/07/20 13:03:30 You still have one too many mThemeColor here.
Lalit Maganti 2015/07/20 13:15:19 Not sure why the previous patch didn't have that.
}
public boolean isInitialized() {
@@ -146,6 +155,10 @@ public class WebappInfo {
return mSource;
}
+ public long themeColor() {
+ return mThemeColor;
+ }
+
// This is needed for clients that want to send the icon trough an intent.
public String getEncodedIcon() {
if (mIcon == null) return "";

Powered by Google App Engine
This is Rietveld 408576698