jni_utils.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2014 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_JNI_UTILS_H_
  5. #define BASE_ANDROID_JNI_UTILS_H_
  6. #include <jni.h>
  7. #include <string>
  8. #include "base/android/scoped_java_ref.h"
  9. namespace base {
  10. namespace android {
  11. // Gets a ClassLoader instance capable of loading Chromium java classes.
  12. // This should be called either from JNI_OnLoad or from within a method called
  13. // via JNI from Java.
  14. BASE_EXPORT ScopedJavaLocalRef<jobject> GetClassLoader(JNIEnv* env);
  15. // Gets a ClassLoader instance which can load Java classes from the specified
  16. // split.
  17. BASE_EXPORT ScopedJavaLocalRef<jobject> GetSplitClassLoader(
  18. JNIEnv* env,
  19. const std::string& split_name);
  20. // Returns true if the current process permits selective JNI registration.
  21. BASE_EXPORT bool IsSelectiveJniRegistrationEnabled(JNIEnv* env);
  22. } // namespace android
  23. } // namespace base
  24. #endif // BASE_ANDROID_JNI_UTILS_H_