1 // Copyright 2016 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 #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 #include "base/time/time.h" 15 16 // Provides helper utility methods that run the given callback with the 17 // specified argument. 18 namespace base { 19 namespace android { 20 21 void BASE_EXPORT RunObjectCallbackAndroid(const JavaRef<jobject>& callback, 22 const JavaRef<jobject>& arg); 23 24 void BASE_EXPORT RunBooleanCallbackAndroid(const JavaRef<jobject>& callback, 25 bool arg); 26 27 void BASE_EXPORT RunIntCallbackAndroid(const JavaRef<jobject>& callback, 28 int32_t arg); 29 30 void BASE_EXPORT RunLongCallbackAndroid(const JavaRef<jobject>& callback, 31 int64_t arg); 32 33 void BASE_EXPORT RunTimeCallbackAndroid(const JavaRef<jobject>& callback, 34 base::Time time); 35 36 void BASE_EXPORT RunStringCallbackAndroid(const JavaRef<jobject>& callback, 37 const std::string& arg); 38 39 void BASE_EXPORT RunByteArrayCallbackAndroid(const JavaRef<jobject>& callback, 40 const std::vector<uint8_t>& arg); 41 42 void BASE_EXPORT RunRunnableAndroid(const JavaRef<jobject>& runnable); 43 44 } // namespace android 45 } // namespace base 46 47 #endif // BASE_ANDROID_CALLBACK_ANDROID_H_ 48