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 28547bfbc1c1751139565e3e3d2f1112552c8a49..8800eaac3d4afe6e27bf4c83f7204b49c8c9f987 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 |
@@ -28,6 +28,10 @@ import org.chromium.webapk.lib.client.WebApkServiceConnectionManager; |
* UI-less Chrome. |
*/ |
public class WebApkActivity extends WebappActivity { |
+ private static final String TAG = "cr_WebApkActivity"; |
+ private ManifestUpgradeDetector mManifestUpgradeDetector = null; |
+ private boolean mIsWebApkRegistered = false; |
+ |
@Override |
protected void onNewIntent(Intent intent) { |
super.onNewIntent(intent); |
@@ -59,12 +63,13 @@ public class WebApkActivity extends WebappActivity { |
@Override |
public void onWebappDataStorageRetrieved( |
WebappDataStorage storage) { |
- storage.updateFromShortcutIntent(getIntent()); |
+ storage.updateFromShortcutIntent(getIntent(), true); |
+ mIsWebApkRegistered = true; |
} |
}); |
return; |
} |
- |
+ mIsWebApkRegistered = true; |
// 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 |
@@ -144,6 +149,16 @@ public class WebApkActivity extends WebappActivity { |
} |
@Override |
+ protected void checkUpdates() { |
+ // TODO(hanxi): Asks WebApk's update manager whether to check resources updates. |
+ if (mManifestUpgradeDetector == null && mIsWebApkRegistered) { |
+ mManifestUpgradeDetector = |
+ new ManifestUpgradeDetector(this, getActivityTab(), mWebappInfo); |
+ } |
+ mManifestUpgradeDetector.start(); |
+ } |
+ |
+ @Override |
public void onPause() { |
super.onPause(); |
initializeChildProcessCreationParams(false); |
@@ -165,4 +180,12 @@ public class WebApkActivity extends WebappActivity { |
} |
ChildProcessCreationParams.set(params); |
} |
+ |
+ @Override |
+ protected void onDestroyInternal() { |
+ if (mManifestUpgradeDetector != null) { |
+ mManifestUpgradeDetector.destroy(); |
+ } |
+ super.onDestroyInternal(); |
+ } |
} |