OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/android/content_feature_list.h" | 5 #include "content/browser/android/content_feature_list.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/public/common/content_features.h" |
10 #include "jni/ContentFeatureList_jni.h" | 11 #include "jni/ContentFeatureList_jni.h" |
11 | 12 |
12 using base::android::ConvertJavaStringToUTF8; | 13 using base::android::ConvertJavaStringToUTF8; |
13 using base::android::JavaParamRef; | 14 using base::android::JavaParamRef; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 namespace android { | 17 namespace android { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Array of features exposed through the Java ContentFeatureList API. Entries in | 21 // Array of features exposed through the Java ContentFeatureList API. Entries in |
21 // this array may either refer to features defined in the header of this file or | 22 // this array may either refer to features defined in the header of this file or |
22 // in other locations in the code base (e.g. content_features.h). | 23 // in other locations in the code base (e.g. content_features.h). |
23 const base::Feature* kFeaturesExposedToJava[] = { | 24 const base::Feature* kFeaturesExposedToJava[] = { |
24 &kRequestUnbufferedDispatch, | 25 &kRequestUnbufferedDispatch, &features::kWebNfc, |
25 }; | 26 }; |
26 | 27 |
27 const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { | 28 const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { |
28 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 29 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
29 if (kFeaturesExposedToJava[i]->name == feature_name) | 30 if (kFeaturesExposedToJava[i]->name == feature_name) |
30 return kFeaturesExposedToJava[i]; | 31 return kFeaturesExposedToJava[i]; |
31 } | 32 } |
32 NOTREACHED() << "Queried feature cannot be found in ContentFeatureList: " | 33 NOTREACHED() << "Queried feature cannot be found in ContentFeatureList: " |
33 << feature_name; | 34 << feature_name; |
34 return nullptr; | 35 return nullptr; |
(...skipping 12 matching lines...) Expand all Loading... |
47 FindFeatureExposedToJava(ConvertJavaStringToUTF8(env, jfeature_name)); | 48 FindFeatureExposedToJava(ConvertJavaStringToUTF8(env, jfeature_name)); |
48 return base::FeatureList::IsEnabled(*feature); | 49 return base::FeatureList::IsEnabled(*feature); |
49 } | 50 } |
50 | 51 |
51 bool RegisterContentFeatureListJni(JNIEnv* env) { | 52 bool RegisterContentFeatureListJni(JNIEnv* env) { |
52 return RegisterNativesImpl(env); | 53 return RegisterNativesImpl(env); |
53 } | 54 } |
54 | 55 |
55 } // namespace android | 56 } // namespace android |
56 } // namespace content | 57 } // namespace content |
OLD | NEW |