| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/webapk/chrome_webapk_host.h" | 5 #include "chrome/browser/android/webapk/chrome_webapk_host.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/chrome_feature_list.h" | 7 #include "chrome/browser/android/chrome_feature_list.h" |
| 8 #include "components/variations/variations_associated_data.h" | 8 #include "components/variations/variations_associated_data.h" |
| 9 #include "jni/ChromeWebApkHost_jni.h" | 9 #include "jni/ChromeWebApkHost_jni.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // Variations flag to enable installing WebAPKs using Google Play. | 13 // Variations flag to enable installing WebAPKs using Google Play. |
| 14 const char* kPlayInstall = "play_install"; | 14 const char* kPlayInstall = "play_install"; |
| 15 | 15 |
| 16 } // anonymous namespace | 16 } // anonymous namespace |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 bool ChromeWebApkHost::Register(JNIEnv* env) { | 19 bool ChromeWebApkHost::Register(JNIEnv* env) { |
| 20 return RegisterNativesImpl(env); | 20 return RegisterNativesImpl(env); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 bool ChromeWebApkHost::AreWebApkEnabled() { | 24 bool ChromeWebApkHost::CanInstallWebApk() { |
| 25 JNIEnv* env = base::android::AttachCurrentThread(); | 25 JNIEnv* env = base::android::AttachCurrentThread(); |
| 26 return Java_ChromeWebApkHost_areWebApkEnabled(env); | 26 return Java_ChromeWebApkHost_canInstallWebApk(env); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 jboolean CanUseGooglePlayToInstallWebApk( | 30 jboolean CanUseGooglePlayToInstallWebApk( |
| 31 JNIEnv* env, | 31 JNIEnv* env, |
| 32 const base::android::JavaParamRef<jclass>& clazz) { | 32 const base::android::JavaParamRef<jclass>& clazz) { |
| 33 return variations::GetVariationParamValueByFeature( | 33 return variations::GetVariationParamValueByFeature( |
| 34 chrome::android::kImprovedA2HS, kPlayInstall) == "true"; | 34 chrome::android::kImprovedA2HS, kPlayInstall) == "true"; |
| 35 } | 35 } |
| 36 |
| 37 // static |
| 38 jboolean CanInstallFromUnknownSources( |
| 39 JNIEnv* env, |
| 40 const base::android::JavaParamRef<jclass>& clazz) { |
| 41 return base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( |
| 42 chrome::android::kImprovedA2HS.name, |
| 43 base::FeatureList::OVERRIDE_ENABLE_FEATURE); |
| 44 } |
| OLD | NEW |