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

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

Issue 2126583002: Reland: Use metadata when launching WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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..29cb18fcc650fafd93f2b9bed62fcd7ea80a5f94 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
@@ -44,6 +44,7 @@ public class WebappDataStorage {
static final String KEY_ACTION = "action";
static final String KEY_IS_ICON_GENERATED = "is_icon_generated";
static final String KEY_VERSION = "version";
+ static final String KEY_WEBAPK_PACKAGE_NAME = "webapk_package_name";
// 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.
@@ -340,6 +341,8 @@ public class WebappDataStorage {
editor.putInt(KEY_SOURCE, IntentUtils.safeGetIntExtra(
shortcutIntent, ShortcutHelper.EXTRA_SOURCE,
ShortcutSource.UNKNOWN));
+ editor.putString(KEY_WEBAPK_PACKAGE_NAME, IntentUtils.safeGetStringExtra(
+ shortcutIntent, ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME));
updated = true;
}
if (updated) editor.apply();
@@ -360,6 +363,23 @@ public class WebappDataStorage {
}
/**
+ * Returns the theme color stored in this object, or
+ * ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING if it is not stored.
+ */
+ long getThemeColor() {
+ return mPreferences.getLong(KEY_THEME_COLOR,
+ ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
+ }
+
+ /**
+ * Returns the orientation stored in this object, or ScreenOrientationValues.DEFAULT if it is
+ * not stored.
+ */
+ int getOrientation() {
+ return mPreferences.getInt(KEY_ORIENTATION, ScreenOrientationValues.DEFAULT);
+ }
+
+ /**
* Updates the last used time of this object.
*/
void updateLastUsedTime() {
@@ -374,6 +394,13 @@ public class WebappDataStorage {
}
/**
+ * Returns the package name if the data is for a WebAPK, null otherwise.
+ */
+ String getWebApkPackageName() {
+ return mPreferences.getString(KEY_WEBAPK_PACKAGE_NAME, null);
+ }
+
+ /**
* 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