| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
|
| index d8f9a94e60abc0838bc7e7ea776c6524a31f0b4a..816bf42dd950699aa93b0bfe7bbd97c05fb1ec7d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
|
| @@ -93,14 +93,14 @@ public class WebApkInstaller {
|
| }
|
|
|
| if (!installOrUpdateDownloadedWebApkImpl(filePath)) {
|
| - notify(false);
|
| + notify(WebApkInstallResult.FAILURE);
|
| return;
|
| }
|
|
|
| if (isUpdate) {
|
| // InstallerDelegate cannot detect whether updates are successful. Assume that update is
|
| // successful.
|
| - notify(true);
|
| + notify(WebApkInstallResult.SUCCESS);
|
| }
|
| }
|
|
|
| @@ -117,7 +117,7 @@ public class WebApkInstaller {
|
| private void installOrUpdateWebApkFromGooglePlayAsync(boolean isUpdate, String packageName,
|
| int version, String title, String token, String url) {
|
| if (mGooglePlayWebApkInstallDelegate == null) {
|
| - notify(false);
|
| + notify(WebApkInstallResult.FAILURE);
|
| return;
|
| }
|
|
|
| @@ -127,22 +127,25 @@ public class WebApkInstaller {
|
| // For updates, if the WebAPK is already up to date and there is no new version, the WebAPK
|
| // server should have returned invalid data and we should not get here.
|
| if (!isUpdate && isWebApkInstalled(packageName)) {
|
| - notify(true);
|
| + notify(WebApkInstallResult.SUCCESS);
|
| return;
|
| }
|
|
|
| Callback<Boolean> callback = new Callback<Boolean>() {
|
| @Override
|
| public void onResult(Boolean success) {
|
| - WebApkInstaller.this.notify(success);
|
| + // TODO(pkotwicz): Send WebApkInstallResult.PROBABLY_FAILURE result if
|
| + // install timed out.
|
| + WebApkInstaller.this.notify(
|
| + success ? WebApkInstallResult.SUCCESS : WebApkInstallResult.FAILURE);
|
| }
|
| };
|
| mGooglePlayWebApkInstallDelegate.installAsync(
|
| packageName, version, title, token, url, callback);
|
| }
|
|
|
| - private void notify(boolean success) {
|
| - if (mAddHomescreenShortcut && success) {
|
| + private void notify(int webApkInstallResult) {
|
| + if (mAddHomescreenShortcut && webApkInstallResult == WebApkInstallResult.SUCCESS) {
|
| ShortcutHelper.addWebApkShortcut(
|
| ContextUtils.getApplicationContext(), mWebApkPackageName);
|
| }
|
| @@ -152,7 +155,7 @@ public class WebApkInstaller {
|
| }
|
| mInstallTask = null;
|
| if (mNativePointer != 0) {
|
| - nativeOnInstallFinished(mNativePointer, success);
|
| + nativeOnInstallFinished(mNativePointer, webApkInstallResult);
|
| }
|
| }
|
|
|
| @@ -184,7 +187,10 @@ public class WebApkInstaller {
|
| @Override
|
| public void onInstallFinished(InstallerDelegate task, boolean success) {
|
| if (mInstallTask != task) return;
|
| - WebApkInstaller.this.notify(success);
|
| + // TODO(pkotwicz): Return WebApkInstallResult.PROBABLY_FAILURE if the install
|
| + // timed out.
|
| + WebApkInstaller.this.notify(
|
| + success ? WebApkInstallResult.SUCCESS : WebApkInstallResult.FAILURE);
|
| }
|
| };
|
| }
|
| @@ -203,7 +209,7 @@ public class WebApkInstaller {
|
| */
|
| if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES
|
| && !isWebApkInstalled(mWebApkPackageName)) {
|
| - WebApkInstaller.this.notify(false);
|
| + WebApkInstaller.this.notify(WebApkInstallResult.PROBABLY_FAILURE);
|
| return;
|
| }
|
| }
|
| @@ -215,5 +221,6 @@ public class WebApkInstaller {
|
| return InstallerDelegate.isInstalled(packageManager, packageName);
|
| }
|
|
|
| - private native void nativeOnInstallFinished(long nativeWebApkInstaller, boolean success);
|
| + private native void nativeOnInstallFinished(
|
| + long nativeWebApkInstaller, int webApkInstallResult);
|
| }
|
|
|