| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
|
| index 146590b1ae2f5039dd8c04f5084af115374b501b..e33a84d54f607e96c705c6c0fd422d6c8086b634 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
|
| @@ -17,7 +17,6 @@ import org.chromium.chrome.browser.tab.TabDelegateFactory;
|
| import org.chromium.chrome.browser.tab.TabRedirectHandler;
|
| import org.chromium.components.navigation_interception.NavigationParams;
|
| import org.chromium.content.browser.ChildProcessCreationParams;
|
| -import org.chromium.content.browser.ScreenOrientationProvider;
|
| import org.chromium.content_public.browser.LoadUrlParams;
|
| import org.chromium.ui.base.PageTransition;
|
| import org.chromium.webapk.lib.client.WebApkServiceConnectionManager;
|
| @@ -48,43 +47,29 @@ public class WebApkActivity extends WebappActivity {
|
| }
|
|
|
| @Override
|
| - protected void onDataStorageFetched(WebappDataStorage storage) {
|
| - if (storage == null) {
|
| - recordSplashScreenThemeColorUma();
|
| - initializeSplashScreenWidgets(null);
|
| - // Register the WebAPK. It is possible that a WebAPK's meta data was deleted when user
|
| - // cleared Chrome's data. When it is launching again, we know that the WebAPK is
|
| - // still installed, so re-register it.
|
| - WebappRegistry.registerWebapp(WebApkActivity.this, getId(),
|
| - new WebappRegistry.FetchWebappDataStorageCallback() {
|
| - @Override
|
| - public void onWebappDataStorageRetrieved(
|
| - WebappDataStorage storage) {
|
| - storage.updateFromShortcutIntent(getIntent());
|
| - // Initialize the update related timestamps to the registration time.
|
| - storage.updateTimeOfLastCheckForUpdatedWebManifest();
|
| - storage.updateTimeOfLastWebApkUpdateRequestCompletion();
|
| - }
|
| - });
|
| - return;
|
| - }
|
| -
|
| - // Update WebappInfo from WebappDataStorage because the information in WebappDataStorage
|
| - // is more up to date than the information in the launch intent. Whenever the Web Manifest
|
| - // changes, WebappDataStorage is updated. Depending on which of the Web Manifest's fields
|
| - // change a new WebAPK may or may not be downloaded from the WebAPK server.
|
| - // TODO(hanxi): Introduces data fetcher to detect web manifest changes and update
|
| - // SharedPreference for WebAPKs.
|
| - int orientation = storage.getOrientation();
|
| - if (mWebappInfo.orientation() != orientation) {
|
| - mWebappInfo.updateOrientation(orientation);
|
| - ScreenOrientationProvider.lockOrientation(
|
| - (byte) mWebappInfo.orientation(), WebApkActivity.this);
|
| - }
|
| - mWebappInfo.updateThemeColor(storage.getThemeColor());
|
| - recordSplashScreenThemeColorUma();
|
| - storage.updateLastUsedTime();
|
| - retrieveSplashScreenImage(storage);
|
| + protected void onStorageIsNull(final int backgroundColor) {
|
| + // Register the WebAPK. It is possible that a WebAPK's meta data was deleted when user
|
| + // cleared Chrome's data. When it is launched again, we know that the WebAPK is still
|
| + // installed, so re-register it.
|
| + WebappRegistry.registerWebapp(WebApkActivity.this, getId(),
|
| + new WebappRegistry.FetchWebappDataStorageCallback() {
|
| + @Override
|
| + public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
|
| + updateStorage(storage);
|
| + // Initialize the update related timestamps to the registration time.
|
| + storage.updateTimeOfLastCheckForUpdatedWebManifest();
|
| + storage.updateTimeOfLastWebApkUpdateRequestCompletion();
|
| + // The downloading of the splash screen image happens before a WebAPK's
|
| + // package name is available. If we want to use the image in the first
|
| + // launch, we need to cache the image, register the WebAPK and store the
|
| + // image in the SharedPreference when the WebAPK is installed
|
| + // (before the first launch), and delete the cached image if it's not
|
| + // installed. Therefore, lots of complexity will be introduced. To simplify
|
| + // the logic, WebAPKs are registered during the first launch, and don't
|
| + // retrieve splash screen image but use app icon for initialization.
|
| + initializeSplashScreenWidgets(backgroundColor, null);
|
| + }
|
| + });
|
| }
|
|
|
| @Override
|
|
|