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

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

Issue 2948713002: Update WebAPK after the user closes WebAPK
Patch Set: Merge branch 'background_updates4' into background_updates Created 3 years, 3 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/WebappRegistry.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
index 36352c12d96fffb8d938aa8815ccf82b8672a75c..3cd7fbd6c895e79e8061e240f84f470b88769ac3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
+import android.text.TextUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.VisibleForTesting;
@@ -17,9 +18,11 @@ import org.chromium.chrome.browser.browsing_data.UrlFilter;
import org.chromium.chrome.browser.browsing_data.UrlFilterBridge;
import org.chromium.webapk.lib.common.WebApkConstants;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -168,6 +171,18 @@ public class WebappRegistry {
return bestMatch;
}
+ /** Returns the list of WebAPK IDs with pending updates. */
+ public List<String> findWebApksWithPendingUpdate() {
+ ArrayList<String> webApkIdsWithPendingUpdate = new ArrayList<String>();
+ for (HashMap.Entry<String, WebappDataStorage> entry : mStorages.entrySet()) {
+ WebappDataStorage storage = entry.getValue();
+ if (!TextUtils.isEmpty(storage.getPendingUpdateRequestPath())) {
+ webApkIdsWithPendingUpdate.add(entry.getKey());
+ }
+ }
+ return webApkIdsWithPendingUpdate;
+ }
+
/**
* Returns the list of web app IDs which are written to SharedPreferences.
*/

Powered by Google App Engine
This is Rietveld 408576698