int_string_callback.cc 980 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 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. // This file encapsulates the JNI headers generated for IntStringCallback, so
  5. // that the methods defined in the generated headers only end up in one object
  6. // file. This is similar to //base/android/callback_android.*.
  7. #include "base/android/int_string_callback.h"
  8. #include <jni.h>
  9. #include "base/android/jni_string.h"
  10. #include "base/base_jni_headers/IntStringCallback_jni.h"
  11. namespace base {
  12. namespace android {
  13. void RunIntStringCallbackAndroid(const JavaRef<jobject>& callback,
  14. int int_arg,
  15. const std::string& str_arg) {
  16. JNIEnv* env = AttachCurrentThread();
  17. Java_IntStringCallback_onResult(env, callback, int_arg,
  18. ConvertUTF8ToJavaString(env, str_arg));
  19. }
  20. } // namespace android
  21. } // namespace base