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

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

Issue 2730653002: [WebAPK]: Don't do fake install to determine whether Google Play supports WebAPK (Closed)
Patch Set: Merge branch 'launch_webapp' into launch_webapp_simplify 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java ('k') | no next file » | 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/ChromeWebApkHost.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
index 28c1980f115ea5b977ddc4af8bc1d0f5795fcaf1..baffedab6e65090eb8a77e82a610eca59578a167 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
@@ -8,7 +8,6 @@ import android.content.Context;
import android.os.StrictMode;
import android.provider.Settings;
-import org.chromium.base.Callback;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
@@ -57,43 +56,25 @@ public class ChromeWebApkHost {
return installingFromUnknownSourcesAllowed() || canUseGooglePlayToInstallWebApk();
}
- /**
- * Initializes {@link sGooglePlayInstallState}. It checks whether:
- * 1) WebAPKs are enabled.
- * 2) Google Play Service is available on the device.
- * 3) Google Play install is enabled by Chrome.
- * 4) Google Play is up-to-date and with gServices flags turned on.
- * It calls the Google Play Install API to update {@link sGooglePlayInstallState}
- * asynchronously.
- */
- public static void initGooglePlayInstallState() {
+ /** Computes the GooglePlayInstallState. */
+ private static int computeGooglePlayInstallState() {
if (!isGooglePlayInstallEnabledByChromeFeature()) {
- sGooglePlayInstallState = GooglePlayInstallState.DISABLED_BY_VARIATIONS;
- return;
+ return GooglePlayInstallState.DISABLED_BY_VARIATIONS;
}
if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices(
ContextUtils.getApplicationContext(),
new UserRecoverableErrorHandler.Silent())) {
- sGooglePlayInstallState = GooglePlayInstallState.NO_PLAY_SERVICES;
- return;
+ return GooglePlayInstallState.NO_PLAY_SERVICES;
}
GooglePlayWebApkInstallDelegate delegate =
AppHooks.get().getGooglePlayWebApkInstallDelegate();
if (delegate == null) {
- sGooglePlayInstallState = GooglePlayInstallState.DISABLED_OTHER;
- return;
+ return GooglePlayInstallState.DISABLED_OTHER;
}
- Callback<Boolean> callback = new Callback<Boolean>() {
- @Override
- public void onResult(Boolean success) {
- sGooglePlayInstallState = success ? GooglePlayInstallState.SUPPORTED
- : GooglePlayInstallState.DISABLED_BY_PLAY;
- }
- };
- delegate.canInstallWebApk(callback);
+ return GooglePlayInstallState.SUPPORTED;
}
/**
@@ -127,8 +108,7 @@ public class ChromeWebApkHost {
@CalledByNative
private static int getGooglePlayInstallState() {
if (sGooglePlayInstallState == null) {
- sGooglePlayInstallState = GooglePlayInstallState.DISABLED_OTHER;
- initGooglePlayInstallState();
+ sGooglePlayInstallState = computeGooglePlayInstallState();
}
return sGooglePlayInstallState;
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698