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

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

Issue 1391993004: WebApp splashscreen: add UMA to record how a splashscreen is constructed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't assert 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 4328c65de5595e8ae62b8cdf8492a7e29ebc5b12..2c60f386d6554f018216a16c57b556b7b26c68b6 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
@@ -176,6 +176,14 @@ public class WebappInfo {
}
/**
+ * Returns whether the theme color specified in the Intent is valid.
+ * A theme color isn't valid if its value is ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING;
+ */
+ public boolean hasValidThemeColor() {
+ return mThemeColor != ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING;
+ }
+
+ /**
* Background color is actually a 32 bit unsigned integer which encodes a color
* in ARGB format. mBackgroundColor is a long because we also need to encode the
* error state of ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING.
@@ -185,15 +193,20 @@ public class WebappInfo {
}
/**
- * Returns the background color specified by {@link #backgroundColor()} if the value is
- * not ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING. Returns the specified fallback color
- * otherwise.
+ * Returns whether the background color specified in the Intent is valid.
+ * A background color isn't valid if its value is
+ * ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING.
+ */
+ public boolean hasValidBackgroundColor() {
+ return mBackgroundColor != ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING;
+ }
+
+ /**
+ * Returns the background color specified by {@link #backgroundColor()} if
+ * the value is valid. Returns the specified fallback color otherwise.
*/
public int backgroundColor(int fallback) {
- if (mBackgroundColor == ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING) {
- return fallback;
- }
- return (int) mBackgroundColor;
+ return hasValidBackgroundColor() ? (int) mBackgroundColor : fallback;
}
// This is needed for clients that want to send the icon trough an intent.

Powered by Google App Engine
This is Rietveld 408576698