Chromium Code Reviews| Index: content/browser/android/content_feature_list.cc |
| diff --git a/content/browser/android/content_feature_list.cc b/content/browser/android/content_feature_list.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8b9b6dfa4dd01608232f11cf1b911139ca5ba550 |
| --- /dev/null |
| +++ b/content/browser/android/content_feature_list.cc |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/android/content_feature_list.h" |
| + |
| +#include <stddef.h> |
| + |
| +#include <string> |
| + |
| +#include "base/android/jni_string.h" |
| +#include "base/feature_list.h" |
| +#include "base/macros.h" |
| +#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.
|
| +#include "jni/ContentFeatureList_jni.h" |
| + |
| +using base::android::ConvertJavaStringToUTF8; |
| + |
| +namespace content { |
| + |
| +namespace { |
| + |
| +// Array of features exposed through the Java ContentFeatureList API. |
| +const base::Feature* kFeaturesExposedToJava[] = { |
| + &features::kImeThread, |
| +}; |
| + |
| +} // namespace |
| + |
| +static jboolean IsEnabled(JNIEnv* env, |
| + const JavaParamRef<jclass>& clazz, |
| + const JavaParamRef<jstring>& jfeature_name) { |
| + const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
| + for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
| + if (kFeaturesExposedToJava[i]->name == feature_name) |
| + return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
| + } |
| + // Features queried via this API must be present in |kFeaturesExposedToJava|. |
| + NOTREACHED(); |
| + return false; |
| +} |
| + |
| +bool RegisterContentFeatureListJni(JNIEnv* env) { |
| + return RegisterNativesImpl(env); |
| +} |
| + |
| +} // namespace content |