Chromium Code Reviews| 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 1cba9191fb932f02109f3553110eeab88a4626d5..725ef4a9c652ee9a415f97f223572319c69d4887 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 |
| @@ -10,6 +10,7 @@ import android.content.Intent; |
| import android.os.StrictMode; |
| import android.provider.Settings; |
| import android.support.v7.app.AlertDialog; |
| +import android.text.TextUtils; |
| import org.chromium.base.CommandLine; |
| import org.chromium.base.ContextUtils; |
| @@ -20,12 +21,16 @@ import org.chromium.chrome.browser.ChromeFeatureList; |
| import org.chromium.chrome.browser.ChromeSwitches; |
| import org.chromium.chrome.browser.ChromeVersionInfo; |
| import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
| +import org.chromium.components.variations.VariationsAssociatedData; |
| import org.chromium.webapk.lib.client.WebApkValidator; |
| /** |
| * Contains functionality needed for Chrome to host WebAPKs. |
| */ |
| public class ChromeWebApkHost { |
| + /** Flag to enable installing WebAPKs using Google Play. */ |
| + private static final String PLAY_INSTALL = "play_install"; |
| + |
| private static final String TAG = "ChromeWebApkHost"; |
| private static Boolean sEnabledForTesting; |
| @@ -44,15 +49,20 @@ public class ChromeWebApkHost { |
| return isEnabledInPrefs(); |
| } |
| + /** Return whether installing WebAPKs using Google Play is enabled. */ |
| + public static boolean canUseGooglePlayToInstallWebApk() { |
|
pkotwicz
2016/12/02 22:27:04
Personally I would check isEnabled() too (just to
Xi Han
2016/12/05 17:27:54
Ok, it did bother me a lot that whether isEnable()
|
| + return TextUtils.equals(VariationsAssociatedData.getVariationParamValue( |
| + ChromeFeatureList.WEBAPKS, PLAY_INSTALL), "true"); |
| + } |
| + |
| @CalledByNative |
| private static boolean areWebApkEnabled() { |
| return ChromeWebApkHost.isEnabled(); |
| } |
| /** |
| - * Check the cached value to figure out if the feature is enabled. We have |
| - * to use the cached value because native library may not yet been loaded. |
| - * |
| + * Check the cached value to figure out if the feature is enabled. We have to use the cached |
| + * value because native library may not yet been loaded. |
| * @return Whether the feature is enabled. |
| */ |
| private static boolean isEnabledInPrefs() { |