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

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

Issue 2528073002: Add a flag in WebAPK's proto when the Web App Manifest is no longer available. (Closed)
Patch Set: Renaming. Created 4 years 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f492fdfbf072222f1e799595a744d27c148f4e7a..e3fdef32c8d73810a55b0af2518ddb1352e4f15b 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
@@ -116,13 +116,14 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
recordUpdate(storage, false);
if (fetchedInfo != null) {
- updateAsync(fetchedInfo, bestIconUrl);
+ updateAsync(fetchedInfo, bestIconUrl, false /* isManifestStale */);
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, "");
+ // Tell the server that the our version of the Web Manifest might be stale and to ignore
+ // our Web Manifest data if the server's Web Manifest data is newer. This scenario can
+ // occur if the Web Manifest is temporarily unreachable.
+ updateAsync(mInfo, "", true /* isManifestStale */);
}
/**
@@ -135,14 +136,22 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
/**
* Sends request to WebAPK Server to update WebAPK.
*/
- protected void updateAsync(WebApkInfo info, String bestIconUrl) {
+ protected void updateAsync(WebApkInfo info, String bestIconUrl, boolean isManifestStale) {
int versionCode = readVersionCodeFromAndroidManifest(info.webApkPackageName());
- String bestIconMurmur2Hash = info.iconUrlToMurmur2HashMap().get(bestIconUrl);
+ int size = info.iconUrlToMurmur2HashMap().size();
+ String[] iconUrls = new String[size];
+ String[] iconHashes = new String[size];
+ int i = 0;
+ for (Map.Entry<String, String> entry : info.iconUrlToMurmur2HashMap().entrySet()) {
+ iconUrls[i] = entry.getKey();
+ String iconHash = entry.getValue();
+ iconHashes[i] = iconHash != null ? iconHash : "";
+ i++;
+ }
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, isManifestStale);
}
/**
@@ -310,7 +319,8 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
}
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 isManifestStale);
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698