Chromium Code Reviews| 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 37511a3ccab40c6e2f30e3e24c989cb5a3750a48..29997473d5400c2784dd53e634c167872fdd7132 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 |
| @@ -79,6 +79,18 @@ public class WebappDataStorage { |
| } |
| /** |
| + * Deletes the data for a webapp by clearing all the information inside the SharedPreference |
| + * file. This does NOT delete the file itself but the file is left empty. |
| + * NOTE: Package private for use by WebappRegistry |
|
gone
2015/09/08 20:38:13
nit: Remove the NOTE since it's useful. Saying wh
Lalit Maganti
2015/09/09 15:27:46
Done.
|
| + * @param context The context to read the SharedPreferences file. |
| + * @param webappId The ID of the webapp being deleted. |
| + */ |
| + static void delete(final Context context, final String webappId) { |
|
gone
2015/09/08 20:38:13
delete is too vague. Sounds like you're deleting
Lalit Maganti
2015/09/09 15:27:46
Done.
|
| + assert !ThreadUtils.runningOnUiThread(); |
| + openSharedPreferences(context, webappId).edit().clear().commit(); |
| + } |
| + |
| + /** |
| * Sets the factory used to generate WebappDataStorage objects. |
| */ |
| @VisibleForTesting |
| @@ -86,11 +98,15 @@ public class WebappDataStorage { |
| sFactory = factory; |
| } |
| - protected WebappDataStorage(Context context, String webappId) { |
| - mPreferences = context.getApplicationContext().getSharedPreferences( |
| + private static SharedPreferences openSharedPreferences(Context context, String webappId) { |
| + return context.getApplicationContext().getSharedPreferences( |
| SHARED_PREFS_FILE_PREFIX + webappId, Context.MODE_PRIVATE); |
| } |
| + protected WebappDataStorage(Context context, String webappId) { |
| + mPreferences = openSharedPreferences(context, webappId); |
| + } |
| + |
| /* |
| * Asynchronously retrieves the splash screen image associated with the |
| * current web app. |