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

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

Issue 2733543002: [Android:WebAPK] Don't add webapp to homescreen if WebAPK install times out part 1/3 (Closed)
Patch Set: Merge branch 'start' into refactor_shortcut_helper3 Created 3 years, 9 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/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 202d6afae19f9c8ba7ac1d8b4131aa460c943759..3cff61d0a10b1c391df28970eef09eeaf45c5658 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
@@ -150,14 +150,14 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
if (!needsUpgrade) {
if (!mStorage.didPreviousUpdateSucceed()) {
- recordUpdate(mStorage, true /* success */, false /* relaxUpdates */);
+ recordUpdate(mStorage, WebApkInstallResult.SUCCESS, false /* relaxUpdates */);
}
return;
}
// Set WebAPK update as having failed in case that Chrome is killed prior to
// {@link onBuiltWebApk} being called.
- recordUpdate(mStorage, false /* success */, false /* relaxUpdates*/);
+ recordUpdate(mStorage, WebApkInstallResult.FAILURE, false /* relaxUpdates*/);
if (fetchedInfo != null) {
scheduleUpdate(fetchedInfo, bestIconUrl, false /* isManifestStale */);
@@ -296,12 +296,12 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
* Updates {@link WebappDataStorage} with the time of the latest WebAPK update and whether the
* WebAPK update succeeded.
*/
- private static void recordUpdate(
- WebappDataStorage storage, boolean success, boolean relaxUpdates) {
+ private static void recordUpdate(WebappDataStorage storage,
+ @WebApkInstallResult.WebApkInstallResultEnum int result, boolean relaxUpdates) {
// Update the request time and result together. It prevents getting a correct request time
// but a result from the previous request.
storage.updateTimeOfLastWebApkUpdateRequestCompletion();
- storage.updateDidLastWebApkUpdateRequestSucceed(success);
+ storage.updateDidLastWebApkUpdateRequestSucceed(result == WebApkInstallResult.SUCCESS);
storage.setRelaxedUpdates(relaxUpdates);
}
@@ -359,11 +359,12 @@ public class WebApkUpdateManager implements WebApkUpdateDataFetcher.Observer {
* fails.
*/
@CalledByNative
- private static void onBuiltWebApk(String id, boolean success, boolean relaxUpdates) {
+ private static void onBuiltWebApk(String id,
+ @WebApkInstallResult.WebApkInstallResultEnum int result, boolean relaxUpdates) {
WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataStorage(id);
if (storage == null) return;
- recordUpdate(storage, success, relaxUpdates);
+ recordUpdate(storage, result, relaxUpdates);
}
private static native void nativeUpdateAsync(String id, String startUrl, String scope,

Powered by Google App Engine
This is Rietveld 408576698