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

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

Issue 2071213005: Use metadata when launching WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add WebAPK's metadata in WebappDataStorage. Created 4 years, 6 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/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 5ddee243bc56c741a54ca135ace38b0085a04ec7..c254b6f7fa9efc6d66c3b3dd24f07fab11fe8290 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
@@ -45,12 +45,18 @@ public class WebappDataStorage {
static final String KEY_IS_ICON_GENERATED = "is_icon_generated";
static final String KEY_VERSION = "version";
+ // 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";
+
// 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;
static final long LAST_USED_INVALID = -1;
static final String URL_INVALID = "";
static final int VERSION_INVALID = 0;
+ static final long TIME_INVALID = -1;
// We use a heuristic to determine whether a web app is still installed on the home screen, as
// there is no way to do so directly. Any web app which has been opened in the last ten days
@@ -180,6 +186,7 @@ public class WebappDataStorage {
editor.putLong(KEY_LAST_USED, LAST_USED_UNSET);
editor.remove(KEY_URL);
editor.remove(KEY_SCOPE);
+ editor.remove(KEY_LAST_REQUEST_NEW_VERSION_SHELL_APK_TIME);
editor.apply();
}
@@ -359,6 +366,20 @@ public class WebappDataStorage {
return mPreferences.getString(KEY_URL, URL_INVALID);
}
+ int getOrientation() {
+ return mPreferences.getInt(KEY_ORIENTATION, ScreenOrientationValues.DEFAULT);
+ }
+
+ long getBackgroundColor() {
+ return mPreferences.getLong(KEY_BACKGROUND_COLOR,
+ ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
+ }
+
+ long getThemeColor() {
+ return mPreferences.getLong(KEY_THEME_COLOR,
+ ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
+ }
+
/**
* Updates the last used time of this object.
*/
@@ -374,6 +395,23 @@ public class WebappDataStorage {
}
/**
+ * Updates the time of the last request to WebAPK Minting Server to download and install new
+ * ShellAPK version.
+ */
+ void updateLastRequestForNewShellApkVersionTime() {
pkotwicz 2016/06/20 18:26:15 Nit: Can you do this change as part of a separate
Xi Han 2016/06/22 15:55:28 Done.
+ 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);
+ }
+
+ /**
* Returns true if this web app has been launched from home screen recently (within
* WEBAPP_LAST_OPEN_MAX_TIME milliseconds).
*/

Powered by Google App Engine
This is Rietveld 408576698