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

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

Issue 2126583002: Reland: Use metadata when launching WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698