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 9c85fda3d5e709d921f9b00197216815577ed8d2..650fcb7dae17c9d1552bc9e133e6c5678f3ca1d8 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 |
@@ -33,6 +33,7 @@ public class WebappDataStorage { |
static final String SHARED_PREFS_FILE_PREFIX = "webapp_"; |
static final String KEY_SPLASH_ICON = "splash_icon"; |
static final String KEY_LAST_USED = "last_used"; |
+ static final String KEY_HAS_BEEN_LAUNCHED = "has_been_launched"; |
static final String KEY_URL = "url"; |
static final String KEY_SCOPE = "scope"; |
static final String KEY_ICON = "icon"; |
@@ -291,10 +292,12 @@ public class WebappDataStorage { |
} |
/** |
- * Returns true if this web app has been launched from home screen recently (within |
- * WEBAPP_LAST_OPEN_MAX_TIME milliseconds). |
+ * Returns true if this web app recently (within WEBAPP_LAST_OPEN_MAX_TIME milliseconds) was |
+ * either: |
+ * - registered with WebappRegistry |
+ * - launched from the homescreen |
*/ |
- public boolean wasLaunchedRecently() { |
+ public boolean wasUsedRecently() { |
// WebappRegistry.register sets the last used time, so that counts as a 'launch'. |
return (sClock.currentTimeMillis() - getLastUsedTime() < WEBAPP_LAST_OPEN_MAX_TIME); |
} |
@@ -315,6 +318,7 @@ public class WebappDataStorage { |
SharedPreferences.Editor editor = mPreferences.edit(); |
editor.remove(KEY_LAST_USED); |
+ editor.remove(KEY_HAS_BEEN_LAUNCHED); |
editor.remove(KEY_URL); |
editor.remove(KEY_SCOPE); |
editor.remove(KEY_LAST_CHECK_WEB_MANIFEST_UPDATE_TIME); |
@@ -374,6 +378,16 @@ public class WebappDataStorage { |
mPreferences.edit().putLong(KEY_LAST_USED, sClock.currentTimeMillis()).apply(); |
} |
+ /** Returns true if the web app has been launched at least once from the home screen. */ |
+ boolean hasBeenLaunched() { |
+ return mPreferences.getBoolean(KEY_HAS_BEEN_LAUNCHED, false); |
+ } |
+ |
+ /** Sets whether the web app was launched at least once from the home screen. */ |
+ void setHasBeenLaunched() { |
+ mPreferences.edit().putBoolean(KEY_HAS_BEEN_LAUNCHED, true).apply(); |
+ } |
+ |
/** |
* Returns the package name if the data is for a WebAPK, null otherwise. |
*/ |