Chromium Code Reviews| Index: chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/HostBrowserLauncher.java |
| diff --git a/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/HostBrowserLauncher.java b/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/HostBrowserLauncher.java |
| index ec62711714af20ccc812ef4aa1a0eeaa0b6e5e5d..0d9ce12d2ec6f754b12a2d4ca755342cc951bef8 100644 |
| --- a/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/HostBrowserLauncher.java |
| +++ b/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/HostBrowserLauncher.java |
| @@ -36,6 +36,8 @@ public class HostBrowserLauncher { |
| private static final String META_DATA_BACKGROUND_COLOR = "backgroundColor"; |
| private static final String META_DATA_ICON_URL = "iconUrl"; |
| private static final String META_DATA_WEB_MANIFEST_URL = "webManifestUrl"; |
|
pkotwicz
2016/07/19 18:02:38
Nit: new line
Xi Han
2016/07/20 18:55:00
Done.
|
| + // This value is equal to kInvalidOrMissingColor in the C++ content::Manifest struct. |
| + private static final long MANIFEST_COLOR_INVALID_OR_MISSING = ((long) Integer.MAX_VALUE) + 1; |
| /** |
| * Key for passing app icon id in Bundle to {@link #launch()}. |
| @@ -83,8 +85,8 @@ public class HostBrowserLauncher { |
| String name = metaBundle.getString(META_DATA_NAME); |
| String displayMode = metaBundle.getString(META_DATA_DISPLAY_MODE); |
| String orientation = metaBundle.getString(META_DATA_ORIENTATION); |
| - long themeColor = getLongFromBundle(metaBundle, META_DATA_THEME_COLOR); |
| - long backgroundColor = getLongFromBundle(metaBundle, META_DATA_BACKGROUND_COLOR); |
| + long themeColor = getColorFromBundle(metaBundle, META_DATA_THEME_COLOR); |
| + long backgroundColor = getColorFromBundle(metaBundle, META_DATA_BACKGROUND_COLOR); |
| boolean isIconGenerated = TextUtils.isEmpty(metaBundle.getString(META_DATA_ICON_URL)); |
| String webManifestUrl = metaBundle.getString(META_DATA_WEB_MANIFEST_URL); |
| Log.v(TAG, "Url of the WebAPK: " + url); |
| @@ -135,13 +137,13 @@ public class HostBrowserLauncher { |
| } |
| /** |
| - * Gets a long from a Bundle. The long should be terminated with 'L'. This function is more |
|
pkotwicz
2016/07/19 18:02:38
Nit: Keep the part about "This function is more re
Xi Han
2016/07/20 18:55:00
Done.
|
| - * reliable than Bundle#getLong() which returns 0 if the value is below Float.MAX_VALUE. |
| + * Gets a long value of a color from a Bundle. The long should be terminated with 'L'. |
|
pkotwicz
2016/07/19 18:02:38
Nit: "a long value" -> "the long value"
Xi Han
2016/07/20 18:55:00
Done.
|
| + * Returns {@link MANIFEST_COLOR_INVALID_OR_MISSING} when the color is missing. |
| */ |
| - private static long getLongFromBundle(Bundle bundle, String key) { |
| + private static long getColorFromBundle(Bundle bundle, String key) { |
| String value = bundle.getString(key); |
| if (value == null || !value.endsWith("L")) { |
| - return 0; |
| + return MANIFEST_COLOR_INVALID_OR_MISSING; |
| } |
| try { |
| return Long.parseLong(value.substring(0, value.length() - 1)); |