xref: /aosp_15_r20/external/cronet/base/android/int_string_callback.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // This file encapsulates the JNI headers generated for IntStringCallback, so
6 // that the methods defined in the generated headers only end up in one object
7 // file. This is similar to //base/android/callback_android.*.
8 
9 #include "base/android/int_string_callback.h"
10 
11 #include <jni.h>
12 
13 #include "base/android/jni_string.h"
14 #include "base/base_jni/IntStringCallback_jni.h"
15 
16 namespace base {
17 namespace android {
18 
RunIntStringCallbackAndroid(const JavaRef<jobject> & callback,int int_arg,const std::string & str_arg)19 void RunIntStringCallbackAndroid(const JavaRef<jobject>& callback,
20                                  int int_arg,
21                                  const std::string& str_arg) {
22   JNIEnv* env = jni_zero::AttachCurrentThread();
23   Java_IntStringCallback_onResult(env, callback, int_arg,
24                                   ConvertUTF8ToJavaString(env, str_arg));
25 }
26 
27 }  // namespace android
28 }  // namespace base
29