OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/android/content_feature_list.h" | |
6 | |
7 #include <stddef.h> | |
8 | |
9 #include <string> | |
10 | |
11 #include "base/android/jni_string.h" | |
12 #include "base/feature_list.h" | |
13 #include "base/macros.h" | |
14 #include "content/public/common/content_features.h" | |
no sievers
2016/03/08 22:08:23
This file and the Java class seem to be in the wro
Changwan Ryu
2016/03/09 01:43:56
That's a good idea! Changed as suggested.
| |
15 #include "jni/ContentFeatureList_jni.h" | |
16 | |
17 using base::android::ConvertJavaStringToUTF8; | |
18 | |
19 namespace content { | |
20 | |
21 namespace { | |
22 | |
23 // Array of features exposed through the Java ContentFeatureList API. | |
24 const base::Feature* kFeaturesExposedToJava[] = { | |
25 &features::kImeThread, | |
26 }; | |
27 | |
28 } // namespace | |
29 | |
30 static jboolean IsEnabled(JNIEnv* env, | |
31 const JavaParamRef<jclass>& clazz, | |
32 const JavaParamRef<jstring>& jfeature_name) { | |
33 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | |
34 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | |
35 if (kFeaturesExposedToJava[i]->name == feature_name) | |
36 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | |
37 } | |
38 // Features queried via this API must be present in |kFeaturesExposedToJava|. | |
39 NOTREACHED(); | |
40 return false; | |
41 } | |
42 | |
43 bool RegisterContentFeatureListJni(JNIEnv* env) { | |
44 return RegisterNativesImpl(env); | |
45 } | |
46 | |
47 } // namespace content | |
OLD | NEW |