| 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 7451339ceffe6380806654b5633e306eca19baee..28547bfbc1c1751139565e3e3d2f1112552c8a49 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
|
| @@ -18,6 +18,7 @@ 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;
|
| @@ -46,10 +47,40 @@ public class WebApkActivity extends WebappActivity {
|
| }
|
|
|
| @Override
|
| - protected void initializeSplashScreenWidgets(final int backgroundColor) {
|
| - // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s implementation
|
| - // when WebAPKs are registered in WebappRegistry.
|
| - initializeSplashScreenWidgets(backgroundColor, null);
|
| + 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());
|
| + }
|
| + });
|
| + 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);
|
| }
|
|
|
| @Override
|
|
|