Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java |
index 29cb18fcc650fafd93f2b9bed62fcd7ea80a5f94..de67d8e8d37ccb101e33a97c376f8dfadad43b20 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java |
@@ -46,6 +46,20 @@ public class WebappDataStorage { |
static final String KEY_VERSION = "version"; |
static final String KEY_WEBAPK_PACKAGE_NAME = "webapk_package_name"; |
+ // The last time that Chrome checks Web Manifest updates for a WebAPK. |
+ public static final String KEY_LAST_CHECK_WEB_MANIFEST_UPDATE_TIME = |
+ "last_check_web_manifest_update_time"; |
+ |
+ // The last time that Chrome sends a request to WebAPK Minting Server to download and install |
+ // new ShellAPK version. |
+ public static final String KEY_LAST_REQUEST_NEW_VERSION_SHELL_APK_TIME = |
+ "last_request_new_version_shell_apk_time"; |
+ |
+ // Whether the last request that Chrome sends to WebAPK Minting Server to download and |
+ // install new ShellAPK version succeeds. |
+ public static final String KEY_DOES_LAST_REQUEST_NEW_VERSION_SHELL_APK_SUCCEED = |
+ "does_last_request_new_version_shell_apk_succeed"; |
+ |
// Unset/invalid constants for last used times and URLs. 0 is used as the null last |
// used time as WebappRegistry assumes that this is always a valid timestamp. |
static final long LAST_USED_UNSET = 0; |
@@ -181,6 +195,9 @@ public class WebappDataStorage { |
editor.putLong(KEY_LAST_USED, LAST_USED_UNSET); |
editor.remove(KEY_URL); |
editor.remove(KEY_SCOPE); |
+ editor.remove(KEY_LAST_CHECK_WEB_MANIFEST_UPDATE_TIME); |
+ editor.remove(KEY_LAST_REQUEST_NEW_VERSION_SHELL_APK_TIME); |
+ editor.remove(KEY_DOES_LAST_REQUEST_NEW_VERSION_SHELL_APK_SUCCEED); |
editor.apply(); |
} |
@@ -401,6 +418,53 @@ public class WebappDataStorage { |
} |
/** |
+ * Updates the time of the last check of whether the WebAPK's Web Manifest is updated. |
+ */ |
+ void updateLastCheckForWebManifestUpdateTime() { |
+ mPreferences.edit().putLong(KEY_LAST_CHECK_WEB_MANIFEST_UPDATE_TIME, |
+ sClock.currentTimeMillis()).apply(); |
+ } |
+ |
+ /** |
+ * Returns the time of the last check of whether the WebAPK's Web Manifest is updated. |
+ */ |
+ long getLastCheckForWebManifestUpdateTime() { |
+ return mPreferences.getLong(KEY_LAST_CHECK_WEB_MANIFEST_UPDATE_TIME, LAST_USED_INVALID); |
+ } |
+ |
+ /** |
+ * Updates the time of the last request to WebAPK Minting Server to download and install new |
+ * ShellAPK version. |
+ */ |
+ void updateLastRequestForNewShellApkVersionTime() { |
+ mPreferences.edit().putLong(KEY_LAST_REQUEST_NEW_VERSION_SHELL_APK_TIME, |
+ sClock.currentTimeMillis()).apply(); |
+ } |
+ |
+ /** |
+ * Returns the time of the last request to WebAPK Minting Server to download and install new |
+ * ShellAPK version. |
+ */ |
+ long getLastRequestForNewShellApkVersionTime() { |
+ return mPreferences.getLong(KEY_LAST_REQUEST_NEW_VERSION_SHELL_APK_TIME, LAST_USED_INVALID); |
+ } |
+ |
+ /** |
+ * Updates the result of whether the last request to WebAPK Minting Server to download and |
+ * install new ShellAPK version succeeds. |
+ */ |
+ void updateDoesLastRequestForNewShellApkVersionSucceed(boolean sucess) { |
+ mPreferences.edit().putBoolean(KEY_DOES_LAST_REQUEST_NEW_VERSION_SHELL_APK_SUCCEED, |
+ sucess).apply(); |
+ } |
+ |
+ /** |
+ * Returns whether the last request to WebAPK Minting Server succeeds. |
+ */ |
+ boolean getDoesLastRequestForNewShellApkVersionSucceed() { |
+ return mPreferences.getBoolean(KEY_DOES_LAST_REQUEST_NEW_VERSION_SHELL_APK_SUCCEED, false); |
+ } |
+ /** |
* Returns true if this web app has been launched from home screen recently (within |
* WEBAPP_LAST_OPEN_MAX_TIME milliseconds). |
*/ |