xref: /aosp_15_r20/external/libchrome/base/android/callback_android.h (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1 // Copyright 2016 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 
5 #ifndef BASE_ANDROID_CALLBACK_ANDROID_H_
6 #define BASE_ANDROID_CALLBACK_ANDROID_H_
7 
8 #include <jni.h>
9 #include <string>
10 #include <vector>
11 
12 #include "base/android/scoped_java_ref.h"
13 #include "base/base_export.h"
14 
15 // Provides helper utility methods that run the given callback with the
16 // specified argument.
17 namespace base {
18 namespace android {
19 
20 void BASE_EXPORT RunObjectCallbackAndroid(const JavaRef<jobject>& callback,
21                                           const JavaRef<jobject>& arg);
22 
23 void BASE_EXPORT RunBooleanCallbackAndroid(const JavaRef<jobject>& callback,
24                                            bool arg);
25 
26 void BASE_EXPORT RunIntCallbackAndroid(const JavaRef<jobject>& callback,
27                                        int arg);
28 
29 void BASE_EXPORT RunStringCallbackAndroid(const JavaRef<jobject>& callback,
30                                           const std::string& arg);
31 
32 void BASE_EXPORT RunByteArrayCallbackAndroid(const JavaRef<jobject>& callback,
33                                              const std::vector<uint8_t>& arg);
34 
35 }  // namespace android
36 }  // namespace base
37 
38 #endif  // BASE_ANDROID_CALLBACK_ANDROID_H_
39