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

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

Issue 2965233003: [Android WebAPK] Make variations only control whether WebAPKs can be installed (Closed)
Patch Set: Merge branch 'master' into chrome_webapk_host Created 3 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
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 3cb43b093749aabd8bc7540abade7d80faff7d31..77270c0faeb9a70ac8b247fe1411009aff042f2e 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
@@ -27,23 +27,17 @@ public class ChromeWebApkHost {
/** Whether installing WebAPks from Google Play is possible. */
private static Integer sGooglePlayInstallState;
- private static Boolean sEnabledForTesting;
+ private static Boolean sInstallsEnabledForTesting;
public static void init() {
WebApkValidator.init(
ChromeWebApkHostSignature.EXPECTED_SIGNATURE, ChromeWebApkHostSignature.PUBLIC_KEY);
}
- public static void initForTesting(boolean enabled) {
- sEnabledForTesting = enabled;
- sGooglePlayInstallState = enabled ? GooglePlayInstallState.SUPPORTED
- : GooglePlayInstallState.NO_PLAY_SERVICES;
- }
-
- public static boolean isEnabled() {
- if (sEnabledForTesting != null) return sEnabledForTesting;
-
- return isEnabledInPrefs();
+ public static void initForTesting(boolean installsEnabled) {
+ sInstallsEnabledForTesting = installsEnabled;
+ sGooglePlayInstallState = installsEnabled ? GooglePlayInstallState.SUPPORTED
+ : GooglePlayInstallState.NO_PLAY_SERVICES;
}
/** Computes the GooglePlayInstallState. */
@@ -66,7 +60,10 @@ public class ChromeWebApkHost {
/** Returns whether installing WebAPKs is possible. */
@CalledByNative
private static boolean canInstallWebApk() {
Yaron 2017/07/06 17:09:15 I think you can go one step further. Remember we t
pkotwicz 2017/07/06 18:49:16 Changing the googleplayinstallstate call is your j
- return isEnabled() && getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED;
+ if (sInstallsEnabledForTesting != null) return sInstallsEnabledForTesting;
+
+ return isEnabledInPrefs()
+ && getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED;
}
@CalledByNative
@@ -79,8 +76,7 @@ public class ChromeWebApkHost {
/* Returns whether launching renderer in WebAPK process is enabled by Chrome. */
public static boolean canLaunchRendererInWebApkProcess() {
- return isEnabled() && LibraryLoader.isInitialized()
- && nativeCanLaunchRendererInWebApkProcess();
+ return LibraryLoader.isInitialized() && nativeCanLaunchRendererInWebApkProcess();
}
/**

Powered by Google App Engine
This is Rietveld 408576698