xref: /aosp_15_r20/external/libchrome/base/android/callback_android.h (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker // Copyright 2016 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Worker 
5*635a8641SAndroid Build Coastguard Worker #ifndef BASE_ANDROID_CALLBACK_ANDROID_H_
6*635a8641SAndroid Build Coastguard Worker #define BASE_ANDROID_CALLBACK_ANDROID_H_
7*635a8641SAndroid Build Coastguard Worker 
8*635a8641SAndroid Build Coastguard Worker #include <jni.h>
9*635a8641SAndroid Build Coastguard Worker #include <string>
10*635a8641SAndroid Build Coastguard Worker #include <vector>
11*635a8641SAndroid Build Coastguard Worker 
12*635a8641SAndroid Build Coastguard Worker #include "base/android/scoped_java_ref.h"
13*635a8641SAndroid Build Coastguard Worker #include "base/base_export.h"
14*635a8641SAndroid Build Coastguard Worker 
15*635a8641SAndroid Build Coastguard Worker // Provides helper utility methods that run the given callback with the
16*635a8641SAndroid Build Coastguard Worker // specified argument.
17*635a8641SAndroid Build Coastguard Worker namespace base {
18*635a8641SAndroid Build Coastguard Worker namespace android {
19*635a8641SAndroid Build Coastguard Worker 
20*635a8641SAndroid Build Coastguard Worker void BASE_EXPORT RunObjectCallbackAndroid(const JavaRef<jobject>& callback,
21*635a8641SAndroid Build Coastguard Worker                                           const JavaRef<jobject>& arg);
22*635a8641SAndroid Build Coastguard Worker 
23*635a8641SAndroid Build Coastguard Worker void BASE_EXPORT RunBooleanCallbackAndroid(const JavaRef<jobject>& callback,
24*635a8641SAndroid Build Coastguard Worker                                            bool arg);
25*635a8641SAndroid Build Coastguard Worker 
26*635a8641SAndroid Build Coastguard Worker void BASE_EXPORT RunIntCallbackAndroid(const JavaRef<jobject>& callback,
27*635a8641SAndroid Build Coastguard Worker                                        int arg);
28*635a8641SAndroid Build Coastguard Worker 
29*635a8641SAndroid Build Coastguard Worker void BASE_EXPORT RunStringCallbackAndroid(const JavaRef<jobject>& callback,
30*635a8641SAndroid Build Coastguard Worker                                           const std::string& arg);
31*635a8641SAndroid Build Coastguard Worker 
32*635a8641SAndroid Build Coastguard Worker void BASE_EXPORT RunByteArrayCallbackAndroid(const JavaRef<jobject>& callback,
33*635a8641SAndroid Build Coastguard Worker                                              const std::vector<uint8_t>& arg);
34*635a8641SAndroid Build Coastguard Worker 
35*635a8641SAndroid Build Coastguard Worker }  // namespace android
36*635a8641SAndroid Build Coastguard Worker }  // namespace base
37*635a8641SAndroid Build Coastguard Worker 
38*635a8641SAndroid Build Coastguard Worker #endif  // BASE_ANDROID_CALLBACK_ANDROID_H_
39