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

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

Issue 2351113005: [Reland] Refactor WebappRegistry into a singleton instance. (Closed)
Patch Set: Fix WebappModeTest Created 4 years, 3 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/WebappActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
index 7022ef318d8d07909215a9e15830a78a08f042f5..ac8358bab00dece4e6e3f4a641342c826f2ccbd5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -60,8 +60,6 @@ public class WebappActivity extends FullScreenActivity {
protected WebappInfo mWebappInfo;
- private boolean mOldWebappCleanupStarted;
-
private ViewGroup mSplashScreen;
private WebappUrlBar mUrlBar;
@@ -126,7 +124,14 @@ public class WebappActivity extends FullScreenActivity {
@Override
public void preInflationStartup() {
WebappInfo info = WebappInfo.create(getIntent());
- if (info != null) mWebappInfo = info;
+
+ String id = "";
+ if (info != null) {
+ mWebappInfo = info;
+ id = info.id();
+ }
+
+ WebappRegistry.warmUpSharedPrefs(id);
Peter Wen 2016/09/29 18:24:47 To get the full benefit of warming up shared prefs
dominickn 2016/09/30 00:17:01 This will only warm two preferences: the WebappReg
Peter Wen 2016/09/30 13:59:19 Ah, right. Good point, didn't realize about the id
dominickn 2016/10/04 01:09:17 Done. Thanks for the explanations on this. :)
ScreenOrientationProvider.lockOrientation((byte) mWebappInfo.orientation(), this);
super.preInflationStartup();
@@ -195,13 +200,6 @@ public class WebappActivity extends FullScreenActivity {
updateTaskDescription();
}
super.onResume();
-
- // Kick off the old web app cleanup (if we haven't already) now that we have queued the
- // current web app's storage to be opened.
- if (!mOldWebappCleanupStarted) {
- WebappRegistry.unregisterOldWebapps(System.currentTimeMillis());
- mOldWebappCleanupStarted = true;
- }
}
@Override
@@ -262,25 +260,20 @@ public class WebappActivity extends FullScreenActivity {
}
protected void initializeSplashScreenWidgets(final int backgroundColor) {
- WebappRegistry.getWebappDataStorage(
- mWebappInfo.id(), new WebappRegistry.FetchWebappDataStorageCallback() {
- @Override
- public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
- if (storage == null) {
- onStorageIsNull(backgroundColor);
- return;
- }
- updateStorage(storage);
-
- // Retrieve the splash image if it exists.
- storage.getSplashScreenImage(new WebappDataStorage.FetchCallback<Bitmap>() {
- @Override
- public void onDataRetrieved(Bitmap splashImage) {
- initializeSplashScreenWidgets(backgroundColor, splashImage);
- }
- });
- }
- });
+ WebappDataStorage storage =
+ WebappRegistry.getInstance().getWebappDataStorage(mWebappInfo.id());
+ if (storage == null) {
+ onStorageIsNull(backgroundColor);
+ return;
+ }
+
+ updateStorage(storage);
+ storage.getSplashScreenImage(new WebappDataStorage.FetchCallback<Bitmap>() {
+ @Override
+ public void onDataRetrieved(Bitmap splashImage) {
+ initializeSplashScreenWidgets(backgroundColor, splashImage);
+ }
+ });
}
protected void onStorageIsNull(int backgroundColor) {}

Powered by Google App Engine
This is Rietveld 408576698