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

Side by Side Diff: chrome/browser/android/webapk/chrome_webapk_host.cc

Issue 2716493002: Add a variations parameter to control WebAPK renderer launching. (Closed)
Patch Set: Rebase to master Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Variations flag to enable launching Chrome renderer in WebAPK process.
17 const char* kLaunchRendererInWebApkProcess =
18 "launch_renderer_in_webapk_process";
19
16 } // anonymous namespace 20 } // anonymous namespace
17 21
18 // static 22 // static
19 bool ChromeWebApkHost::Register(JNIEnv* env) { 23 bool ChromeWebApkHost::Register(JNIEnv* env) {
20 return RegisterNativesImpl(env); 24 return RegisterNativesImpl(env);
21 } 25 }
22 26
23 // static 27 // static
24 bool ChromeWebApkHost::CanInstallWebApk() { 28 bool ChromeWebApkHost::CanInstallWebApk() {
25 JNIEnv* env = base::android::AttachCurrentThread(); 29 JNIEnv* env = base::android::AttachCurrentThread();
26 return Java_ChromeWebApkHost_canInstallWebApk(env); 30 return Java_ChromeWebApkHost_canInstallWebApk(env);
27 } 31 }
28 32
29 // static 33 // static
30 GooglePlayInstallState ChromeWebApkHost::GetGooglePlayInstallState() { 34 GooglePlayInstallState ChromeWebApkHost::GetGooglePlayInstallState() {
31 JNIEnv* env = base::android::AttachCurrentThread(); 35 JNIEnv* env = base::android::AttachCurrentThread();
32 return static_cast<GooglePlayInstallState>( 36 return static_cast<GooglePlayInstallState>(
33 Java_ChromeWebApkHost_getGooglePlayInstallState(env)); 37 Java_ChromeWebApkHost_getGooglePlayInstallState(env));
34 } 38 }
35 39
36 // static 40 // static
37 jboolean CanUseGooglePlayToInstallWebApk( 41 jboolean CanUseGooglePlayToInstallWebApk(
38 JNIEnv* env, 42 JNIEnv* env,
39 const base::android::JavaParamRef<jclass>& clazz) { 43 const base::android::JavaParamRef<jclass>& clazz) {
40 return variations::GetVariationParamValueByFeature( 44 return variations::GetVariationParamValueByFeature(
41 chrome::android::kImprovedA2HS, kPlayInstall) == "true"; 45 chrome::android::kImprovedA2HS, kPlayInstall) == "true";
42 } 46 }
43 47
44 // static 48 // static
49 jboolean CanLaunchRendererInWebApkProcess(
50 JNIEnv* env,
51 const base::android::JavaParamRef<jclass>& clazz) {
52 return variations::GetVariationParamValueByFeature(
53 chrome::android::kImprovedA2HS, kLaunchRendererInWebApkProcess) ==
54 "true";
55 }
56
57 // static
45 jboolean CanInstallFromUnknownSources( 58 jboolean CanInstallFromUnknownSources(
46 JNIEnv* env, 59 JNIEnv* env,
47 const base::android::JavaParamRef<jclass>& clazz) { 60 const base::android::JavaParamRef<jclass>& clazz) {
48 return base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( 61 return base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine(
49 chrome::android::kImprovedA2HS.name, 62 chrome::android::kImprovedA2HS.name,
50 base::FeatureList::OVERRIDE_ENABLE_FEATURE); 63 base::FeatureList::OVERRIDE_ENABLE_FEATURE);
51 } 64 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698