Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java |
| index 8aacf80f512fd19202852de68ff89a67204ab4a7..66b54fc0388295f64aba0cfce7f1c8894f3f6916 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java |
| @@ -112,13 +112,13 @@ public class WebApkUpdateManager implements ManifestUpgradeDetector.Callback { |
| recordUpdate(storage, false); |
| if (info != null) { |
| - updateAsync(info, bestIconUrl); |
| + updateAsync(info, bestIconUrl, false); |
| return; |
| } |
| // Since we could not fetch the Web Manifest, we do not know what the best icon URL is. Pass |
| // an empty "best icon URL" to tell the server that there is no best icon URL. |
|
pkotwicz
2016/12/09 22:18:55
Please add a comment describing why we set the sta
Xi Han
2016/12/13 20:59:15
SGTM, added.
|
| - updateAsync(mInfo, ""); |
| + updateAsync(mInfo, "", true); |
| } |
| /** |
| @@ -131,14 +131,18 @@ public class WebApkUpdateManager implements ManifestUpgradeDetector.Callback { |
| /** |
| * Sends request to WebAPK Server to update WebAPK. |
| */ |
| - protected void updateAsync(WebApkInfo info, String bestIconUrl) { |
| + protected void updateAsync(WebApkInfo info, String bestIconUrl, boolean staleManifest) { |
| int versionCode = readVersionCodeFromAndroidManifest(info.webApkPackageName()); |
| - String bestIconMurmur2Hash = info.iconUrlToMurmur2HashMap().get(bestIconUrl); |
| + String[] iconUrls = info.iconUrlToMurmur2HashMap().keySet().toArray(new String[0]); |
| + String[] iconHashes = new String[iconUrls.length]; |
| + for (int i = 0; i < iconUrls.length; ++i) { |
|
pkotwicz
2016/12/09 22:18:55
Nit: I suspect that Dominick will want you to use
Xi Han
2016/12/13 20:59:15
Done.
|
| + String iconHash = info.iconUrlToMurmur2HashMap().get(iconUrls[i]); |
| + iconHashes[i] = iconHash != null ? iconHash : ""; |
| + } |
| nativeUpdateAsync(info.id(), info.manifestStartUrl(), info.scopeUri().toString(), |
| - info.name(), info.shortName(), bestIconUrl, bestIconMurmur2Hash, info.icon(), |
| - info.iconUrlToMurmur2HashMap().keySet().toArray(new String[0]), info.displayMode(), |
| - info.orientation(), info.themeColor(), info.backgroundColor(), info.manifestUrl(), |
| - info.webApkPackageName(), versionCode); |
| + info.name(), info.shortName(), bestIconUrl, info.icon(), iconUrls, iconHashes, |
| + info.displayMode(), info.orientation(), info.themeColor(), info.backgroundColor(), |
| + info.manifestUrl(), info.webApkPackageName(), versionCode, staleManifest); |
| } |
| /** |
| @@ -263,7 +267,8 @@ public class WebApkUpdateManager implements ManifestUpgradeDetector.Callback { |
| } |
| private static native void nativeUpdateAsync(String id, String startUrl, String scope, |
| - String name, String shortName, String bestIconUrl, String bestIconMurmur2Hash, |
| - Bitmap bestIcon, String[] iconUrls, int displayMode, int orientation, long themeColor, |
| - long backgroundColor, String manifestUrl, String webApkPackage, int webApkVersion); |
| + String name, String shortName, String bestIconUrl, Bitmap bestIcon, String[] iconUrls, |
| + String[] iconHashes, int displayMode, int orientation, long themeColor, |
| + long backgroundColor, String manifestUrl, String webApkPackage, int webApkVersion, |
| + boolean staleManifest); |
| } |