OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chrome_feature_list.h" | 5 #include "chrome/browser/android/chrome_feature_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "jni/ChromeFeatureList_jni.h" | 14 #include "jni/ChromeFeatureList_jni.h" |
15 | 15 |
16 using base::android::ConvertJavaStringToUTF8; | 16 using base::android::ConvertJavaStringToUTF8; |
17 | 17 |
18 namespace chrome { | 18 namespace chrome { |
19 namespace android { | 19 namespace android { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const base::Feature kPhysicalWebFeature { | |
24 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT | |
25 }; | |
26 | |
27 // Array of features exposed through the Java ChromeFeatureList API. Entries in | 23 // Array of features exposed through the Java ChromeFeatureList API. Entries in |
28 // this array may either refer to features defined in this file (above) or in | 24 // this array may either refer to features defined in this file (above) or in |
29 // other locations in the code base (e.g. chrome/, components/, etc). | 25 // other locations in the code base (e.g. chrome/, components/, etc). |
30 const base::Feature* kFeaturesExposedToJava[] = { | 26 const base::Feature* kFeaturesExposedToJava[] = { |
31 &kPhysicalWebFeature, | 27 &kPhysicalWebFeature, |
32 }; | 28 }; |
33 | 29 |
34 } // namespace | 30 } // namespace |
35 | 31 |
| 32 const base::Feature kPhysicalWebFeature { |
| 33 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT |
| 34 }; |
| 35 |
36 static jboolean IsEnabled(JNIEnv* env, | 36 static jboolean IsEnabled(JNIEnv* env, |
37 const JavaParamRef<jclass>& clazz, | 37 const JavaParamRef<jclass>& clazz, |
38 const JavaParamRef<jstring>& jfeature_name) { | 38 const JavaParamRef<jstring>& jfeature_name) { |
39 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 39 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
40 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 40 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
41 if (kFeaturesExposedToJava[i]->name == feature_name) | 41 if (kFeaturesExposedToJava[i]->name == feature_name) |
42 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 42 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
43 } | 43 } |
44 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 44 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
45 NOTREACHED(); | 45 NOTREACHED(); |
46 return false; | 46 return false; |
47 } | 47 } |
48 | 48 |
49 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 49 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
50 return RegisterNativesImpl(env); | 50 return RegisterNativesImpl(env); |
51 } | 51 } |
52 | 52 |
53 } // namespace android | 53 } // namespace android |
54 } // namespace chrome | 54 } // namespace chrome |
OLD | NEW |