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

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

Issue 2675803004: Fall back to shortcut A2HS when Phonesky is out of date or unavailable. (Closed)
Patch Set: Rebase. Created 3 years, 10 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
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 a32ff99e8f255816a1676f2fa5ecd27c53973032..1f466cda5954b603778eae725c6d4a061bcf172b 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
@@ -20,8 +20,6 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.banners.InstallerDelegate;
-import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
-import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
import org.chromium.chrome.browser.util.IntentUtils;
import java.io.File;
@@ -65,10 +63,7 @@ public class WebApkInstaller {
@CalledByNative
private boolean canUseGooglePlayInstallService() {
- return mGooglePlayWebApkInstallDelegate != null
- && ExternalAuthUtils.getInstance().canUseGooglePlayServices(
- ContextUtils.getApplicationContext(),
- new UserRecoverableErrorHandler.Silent());
+ return ChromeWebApkHost.canUseGooglePlayToInstallWebApk();
}
@CalledByNative
@@ -118,20 +113,27 @@ public class WebApkInstaller {
@CalledByNative
private boolean installWebApkFromGooglePlayAsync(String packageName, int version, String title,
String token, String url) {
- if (mGooglePlayWebApkInstallDelegate == null) return false;
+ if (mGooglePlayWebApkInstallDelegate == null) {
+ notify(false);
+ return false;
+ }
Callback<Boolean> callback = new Callback<Boolean>() {
@Override
public void onResult(Boolean success) {
- if (mNativePointer != 0) {
- nativeOnInstallFinished(mNativePointer, success);
- }
+ WebApkInstaller.this.notify(success);
}
};
return mGooglePlayWebApkInstallDelegate.installAsync(packageName, version, title, token,
url, callback);
}
+ private void notify(boolean success) {
+ if (mNativePointer != 0) {
+ nativeOnInstallFinished(mNativePointer, success);
+ }
+ }
+
/**
* Updates a WebAPK.
* @param filePath File to update.

Powered by Google App Engine
This is Rietveld 408576698