// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file is autogenerated by // base/android/jni_generator/jni_generator.py // For // org/chromium/TestJni #ifndef org_chromium_TestJni_JNI #define org_chromium_TestJni_JNI #include #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" #include "base/basictypes.h" #include "base/logging.h" using base::android::ScopedJavaLocalRef; // Step 1: forward declarations. namespace { const char kTestJniClassPath[] = "org/chromium/TestJni"; const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; // Leaking this jclass as we cannot use LazyInstance from some threads. jclass g_TestJni_clazz = NULL; // Leaking this jclass as we cannot use LazyInstance from some threads. jclass g_InfoBar_clazz = NULL; } // namespace // Step 2: method stubs. static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; static ScopedJavaLocalRef Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, jint nativeInfoBar, jstring buttonOk, jstring buttonCancel, jstring title, jobject icon) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "showConfirmInfoBar", "(" "I" "Ljava/lang/String;" "Ljava/lang/String;" "Ljava/lang/String;" "Landroid/graphics/Bitmap;" ")" "Lorg/chromium/Foo$InnerClass;", &g_TestJni_showConfirmInfoBar); jobject ret = env->CallObjectMethod(obj, method_id, nativeInfoBar, buttonOk, buttonCancel, title, icon); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; static ScopedJavaLocalRef Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, jint nativeInfoBar, jstring realm, jstring account, jstring args) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "showAutoLoginInfoBar", "(" "I" "Ljava/lang/String;" "Ljava/lang/String;" "Ljava/lang/String;" ")" "Lorg/chromium/Foo$InnerClass;", &g_TestJni_showAutoLoginInfoBar); jobject ret = env->CallObjectMethod(obj, method_id, nativeInfoBar, realm, account, args); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_InfoBar_dismiss = 0; static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_InfoBar_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_InfoBar_clazz, "dismiss", "(" ")" "V", &g_InfoBar_dismiss); env->CallVoidMethod(obj, method_id); base::android::CheckException(env); } static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, jstring realm, jstring account, jstring args) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_STATIC>( env, g_TestJni_clazz, "shouldShowAutoLogin", "(" "Landroid/view/View;" "Ljava/lang/String;" "Ljava/lang/String;" "Ljava/lang/String;" ")" "Z", &g_TestJni_shouldShowAutoLogin); jboolean ret = env->CallStaticBooleanMethod(g_TestJni_clazz, method_id, view, realm, account, args); base::android::CheckException(env); return ret; } static base::subtle::AtomicWord g_TestJni_openUrl = 0; static ScopedJavaLocalRef Java_TestJni_openUrl(JNIEnv* env, jstring url) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_STATIC>( env, g_TestJni_clazz, "openUrl", "(" "Ljava/lang/String;" ")" "Ljava/io/InputStream;", &g_TestJni_openUrl); jobject ret = env->CallStaticObjectMethod(g_TestJni_clazz, method_id, url); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, jboolean activated, jint iPid, jint iType, jint iPrimaryID, jint iSecondaryID) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "activateHardwareAcceleration", "(" "Z" "I" "I" "I" "I" ")" "V", &g_TestJni_activateHardwareAcceleration); env->CallVoidMethod(obj, method_id, activated, iPid, iType, iPrimaryID, iSecondaryID); base::android::CheckException(env); } static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, jint iParam) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "uncheckedCall", "(" "I" ")" "V", &g_TestJni_uncheckedCall); env->CallVoidMethod(obj, method_id, iParam); } static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; static ScopedJavaLocalRef Java_TestJni_returnByteArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnByteArray", "(" ")" "[B", &g_TestJni_returnByteArray); jbyteArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; static ScopedJavaLocalRef Java_TestJni_returnBooleanArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnBooleanArray", "(" ")" "[Z", &g_TestJni_returnBooleanArray); jbooleanArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; static ScopedJavaLocalRef Java_TestJni_returnCharArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnCharArray", "(" ")" "[C", &g_TestJni_returnCharArray); jcharArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; static ScopedJavaLocalRef Java_TestJni_returnShortArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnShortArray", "(" ")" "[S", &g_TestJni_returnShortArray); jshortArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; static ScopedJavaLocalRef Java_TestJni_returnIntArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnIntArray", "(" ")" "[I", &g_TestJni_returnIntArray); jintArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; static ScopedJavaLocalRef Java_TestJni_returnLongArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnLongArray", "(" ")" "[J", &g_TestJni_returnLongArray); jlongArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; static ScopedJavaLocalRef Java_TestJni_returnDoubleArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnDoubleArray", "(" ")" "[D", &g_TestJni_returnDoubleArray); jdoubleArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; static ScopedJavaLocalRef Java_TestJni_returnObjectArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnObjectArray", "(" ")" "[Ljava/lang/Object;", &g_TestJni_returnObjectArray); jobjectArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; static ScopedJavaLocalRef Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "returnArrayOfByteArray", "(" ")" "[[B", &g_TestJni_returnArrayOfByteArray); jobjectArray ret = static_cast(env->CallObjectMethod(obj, method_id)); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; static ScopedJavaLocalRef Java_TestJni_getCompressFormat(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "getCompressFormat", "(" ")" "Landroid/graphics/Bitmap$CompressFormat;", &g_TestJni_getCompressFormat); jobject ret = env->CallObjectMethod(obj, method_id); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; static ScopedJavaLocalRef Java_TestJni_getCompressFormatList(JNIEnv* env, jobject obj) { /* Must call RegisterNativesImpl() */ DCHECK(g_TestJni_clazz); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, g_TestJni_clazz, "getCompressFormatList", "(" ")" "Ljava/util/List;", &g_TestJni_getCompressFormatList); jobject ret = env->CallObjectMethod(obj, method_id); base::android::CheckException(env); return ScopedJavaLocalRef(env, ret); } // Step 3: RegisterNatives. static bool RegisterNativesImpl(JNIEnv* env) { g_TestJni_clazz = reinterpret_cast(env->NewGlobalRef( base::android::GetClass(env, kTestJniClassPath).obj())); g_InfoBar_clazz = reinterpret_cast(env->NewGlobalRef( base::android::GetClass(env, kInfoBarClassPath).obj())); return true; } #endif // org_chromium_TestJni_JNI