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..e662711abd2b17e2315ba5880217e72b1ba0962a 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 |
| @@ -18,6 +18,7 @@ import org.chromium.chrome.browser.ChromeSwitches; |
| import org.chromium.chrome.browser.tab.Tab; |
| import org.chromium.webapk.lib.client.WebApkVersion; |
| +import java.util.Set; |
| import java.util.concurrent.TimeUnit; |
| /** |
| @@ -112,13 +113,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. |
| - updateAsync(mInfo, ""); |
| + updateAsync(mInfo, "", true); |
| } |
| /** |
| @@ -131,14 +132,19 @@ 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); |
| + Set<String> iconUrlSet = info.iconUrlToMurmur2HashMap().keySet(); |
| + String[] iconUrls = iconUrlSet.toArray(new String[iconUrlSet.size()]); |
|
pkotwicz
2016/12/07 20:41:30
Shouldn't this be new String[0]
Xi Han
2016/12/09 18:40:11
Done.
|
| + String[] iconHashs = new String[iconUrls.length]; |
|
pkotwicz
2016/12/07 20:41:30
iconHashs -> iconHashes
Xi Han
2016/12/09 18:40:11
Done.
|
| + for (int i = 0; i < iconUrls.length; ++i) { |
| + String icon_hash = info.iconUrlToMurmur2HashMap().get(iconUrls[i]); |
|
pkotwicz
2016/12/07 20:41:30
icon_hash -> iconHash
Xi Han
2016/12/09 18:40:11
Sorry for the wrong naming style again. I will be
|
| + iconHashs[i] = icon_hash != null ? icon_hash : ""; |
| + } |
| 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, iconHashs, |
| + info.displayMode(), info.orientation(), info.themeColor(), info.backgroundColor(), |
| + info.manifestUrl(), info.webApkPackageName(), versionCode, staleManifest); |
| } |
| /** |
| @@ -263,7 +269,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); |
| } |