Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / base / android / field_trial_list.cc
blob9cb38d2910624e7b4ce529d71503c7c935581ab2
1 // Copyright 2014 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.
5 #include "base/android/field_trial_list.h"
7 #include <jni.h>
9 #include "base/android/jni_string.h"
10 #include "base/metrics/field_trial.h"
11 #include "jni/FieldTrialList_jni.h"
13 using base::android::ConvertJavaStringToUTF8;
14 using base::android::ConvertUTF8ToJavaString;
16 static jstring FindFullName(JNIEnv* env,
17 jclass clazz,
18 jstring jtrial_name) {
19 std::string trial_name(ConvertJavaStringToUTF8(env, jtrial_name));
20 return ConvertUTF8ToJavaString(
21 env,
22 base::FieldTrialList::FindFullName(trial_name)).Release();
25 static jboolean TrialExists(JNIEnv* env, jclass clazz, jstring jtrial_name) {
26 std::string trial_name(ConvertJavaStringToUTF8(env, jtrial_name));
27 return base::FieldTrialList::TrialExists(trial_name);
30 namespace base {
31 namespace android {
33 bool RegisterFieldTrialList(JNIEnv* env) {
34 return RegisterNativesImpl(env);
37 } // namespace android
38 } // namespace base