callback_android.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef BASE_ANDROID_CALLBACK_ANDROID_H_
  5. #define BASE_ANDROID_CALLBACK_ANDROID_H_
  6. #include <jni.h>
  7. #include <string>
  8. #include <vector>
  9. #include "base/android/scoped_java_ref.h"
  10. #include "base/base_export.h"
  11. // Provides helper utility methods that run the given callback with the
  12. // specified argument.
  13. namespace base {
  14. namespace android {
  15. void BASE_EXPORT RunObjectCallbackAndroid(const JavaRef<jobject>& callback,
  16. const JavaRef<jobject>& arg);
  17. void BASE_EXPORT RunBooleanCallbackAndroid(const JavaRef<jobject>& callback,
  18. bool arg);
  19. void BASE_EXPORT RunIntCallbackAndroid(const JavaRef<jobject>& callback,
  20. int arg);
  21. void BASE_EXPORT RunStringCallbackAndroid(const JavaRef<jobject>& callback,
  22. const std::string& arg);
  23. void BASE_EXPORT RunByteArrayCallbackAndroid(const JavaRef<jobject>& callback,
  24. const std::vector<uint8_t>& arg);
  25. void BASE_EXPORT RunRunnableAndroid(const JavaRef<jobject>& runnable);
  26. } // namespace android
  27. } // namespace base
  28. #endif // BASE_ANDROID_CALLBACK_ANDROID_H_