Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / variations / android / variations_associated_data_android.cc
blob0693f20cbfec64acb5e9597f90cbd7d9493d8919
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 "components/variations/android/variations_associated_data_android.h"
7 #include <string>
9 #include "base/android/jni_string.h"
10 #include "components/variations/variations_associated_data.h"
11 #include "jni/VariationsAssociatedData_jni.h"
13 using base::android::ConvertJavaStringToUTF8;
14 using base::android::ConvertUTF8ToJavaString;
16 namespace variations {
18 namespace android {
20 ScopedJavaLocalRef<jstring> GetVariationParamValue(
21 JNIEnv* env,
22 const JavaParamRef<jclass>& clazz,
23 const JavaParamRef<jstring>& jtrial_name,
24 const JavaParamRef<jstring>& jparam_name) {
25 std::string trial_name(ConvertJavaStringToUTF8(env, jtrial_name));
26 std::string param_name(ConvertJavaStringToUTF8(env, jparam_name));
27 std::string param_value =
28 variations::GetVariationParamValue(trial_name, param_name);
29 return ConvertUTF8ToJavaString(env, param_value);
32 bool RegisterVariationsAssociatedData(JNIEnv* env) {
33 return RegisterNativesImpl(env);
36 } // namespace android
38 } // namespace variations