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.
5 // This file is autogenerated by
6 // base/android/jni_generator/jni_generator.py
8 // org/chromium/TestJni
10 #ifndef org_chromium_TestJni_JNI
11 #define org_chromium_TestJni_JNI
15 #include "base/android/jni_generator/jni_generator_helper.h"
17 #include "base/android/jni_int_wrapper.h"
19 // Step 1: forward declarations.
21 const char kTestJniClassPath[] = "org/chromium/TestJni";
22 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar";
23 // Leaking this jclass as we cannot use LazyInstance from some threads.
24 jclass g_TestJni_clazz = NULL;
25 #define TestJni_clazz(env) g_TestJni_clazz
26 // Leaking this jclass as we cannot use LazyInstance from some threads.
27 jclass g_InfoBar_clazz = NULL;
28 #define InfoBar_clazz(env) g_InfoBar_clazz
32 // Step 2: method stubs.
34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0;
35 static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env,
36 jobject obj, JniIntWrapper nativeInfoBar,
41 /* Must call RegisterNativesImpl() */
43 TestJni_clazz(env), NULL);
45 base::android::MethodID::LazyGet<
46 base::android::MethodID::TYPE_INSTANCE>(
47 env, TestJni_clazz(env),
55 "Landroid/graphics/Bitmap;"
57 "Lorg/chromium/Foo$InnerClass;",
58 &g_TestJni_showConfirmInfoBar);
61 env->CallObjectMethod(obj,
62 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title,
64 jni_generator::CheckException(env);
65 return ScopedJavaLocalRef<jobject>(env, ret);
68 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0;
69 static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv*
70 env, jobject obj, JniIntWrapper nativeInfoBar,
74 /* Must call RegisterNativesImpl() */
76 TestJni_clazz(env), NULL);
78 base::android::MethodID::LazyGet<
79 base::android::MethodID::TYPE_INSTANCE>(
80 env, TestJni_clazz(env),
81 "showAutoLoginInfoBar",
89 "Lorg/chromium/Foo$InnerClass;",
90 &g_TestJni_showAutoLoginInfoBar);
93 env->CallObjectMethod(obj,
94 method_id, as_jint(nativeInfoBar), realm, account, args);
95 jni_generator::CheckException(env);
96 return ScopedJavaLocalRef<jobject>(env, ret);
99 static base::subtle::AtomicWord g_InfoBar_dismiss = 0;
100 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) {
101 /* Must call RegisterNativesImpl() */
102 CHECK_CLAZZ(env, obj,
104 jmethodID method_id =
105 base::android::MethodID::LazyGet<
106 base::android::MethodID::TYPE_INSTANCE>(
107 env, InfoBar_clazz(env),
115 env->CallVoidMethod(obj,
117 jni_generator::CheckException(env);
121 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0;
122 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view,
126 /* Must call RegisterNativesImpl() */
127 CHECK_CLAZZ(env, TestJni_clazz(env),
128 TestJni_clazz(env), false);
129 jmethodID method_id =
130 base::android::MethodID::LazyGet<
131 base::android::MethodID::TYPE_STATIC>(
132 env, TestJni_clazz(env),
133 "shouldShowAutoLogin",
136 "Landroid/view/View;"
142 &g_TestJni_shouldShowAutoLogin);
145 env->CallStaticBooleanMethod(TestJni_clazz(env),
146 method_id, view, realm, account, args);
147 jni_generator::CheckException(env);
151 static base::subtle::AtomicWord g_TestJni_openUrl = 0;
152 static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring
154 /* Must call RegisterNativesImpl() */
155 CHECK_CLAZZ(env, TestJni_clazz(env),
156 TestJni_clazz(env), NULL);
157 jmethodID method_id =
158 base::android::MethodID::LazyGet<
159 base::android::MethodID::TYPE_STATIC>(
160 env, TestJni_clazz(env),
166 "Ljava/io/InputStream;",
170 env->CallStaticObjectMethod(TestJni_clazz(env),
172 jni_generator::CheckException(env);
173 return ScopedJavaLocalRef<jobject>(env, ret);
176 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0;
177 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj,
181 JniIntWrapper iPrimaryID,
182 JniIntWrapper iSecondaryID) {
183 /* Must call RegisterNativesImpl() */
184 CHECK_CLAZZ(env, obj,
186 jmethodID method_id =
187 base::android::MethodID::LazyGet<
188 base::android::MethodID::TYPE_INSTANCE>(
189 env, TestJni_clazz(env),
190 "activateHardwareAcceleration",
200 &g_TestJni_activateHardwareAcceleration);
202 env->CallVoidMethod(obj,
203 method_id, activated, as_jint(iPid), as_jint(iType),
204 as_jint(iPrimaryID), as_jint(iSecondaryID));
205 jni_generator::CheckException(env);
209 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0;
210 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, JniIntWrapper
212 /* Must call RegisterNativesImpl() */
213 CHECK_CLAZZ(env, obj,
215 jmethodID method_id =
216 base::android::MethodID::LazyGet<
217 base::android::MethodID::TYPE_INSTANCE>(
218 env, TestJni_clazz(env),
225 &g_TestJni_uncheckedCall);
227 env->CallVoidMethod(obj,
228 method_id, as_jint(iParam));
232 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0;
233 static ScopedJavaLocalRef<jbyteArray> Java_TestJni_returnByteArray(JNIEnv* env,
235 /* Must call RegisterNativesImpl() */
236 CHECK_CLAZZ(env, obj,
237 TestJni_clazz(env), NULL);
238 jmethodID method_id =
239 base::android::MethodID::LazyGet<
240 base::android::MethodID::TYPE_INSTANCE>(
241 env, TestJni_clazz(env),
247 &g_TestJni_returnByteArray);
250 static_cast<jbyteArray>(env->CallObjectMethod(obj,
252 jni_generator::CheckException(env);
253 return ScopedJavaLocalRef<jbyteArray>(env, ret);
256 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0;
257 static ScopedJavaLocalRef<jbooleanArray> Java_TestJni_returnBooleanArray(JNIEnv*
259 /* Must call RegisterNativesImpl() */
260 CHECK_CLAZZ(env, obj,
261 TestJni_clazz(env), NULL);
262 jmethodID method_id =
263 base::android::MethodID::LazyGet<
264 base::android::MethodID::TYPE_INSTANCE>(
265 env, TestJni_clazz(env),
266 "returnBooleanArray",
271 &g_TestJni_returnBooleanArray);
274 static_cast<jbooleanArray>(env->CallObjectMethod(obj,
276 jni_generator::CheckException(env);
277 return ScopedJavaLocalRef<jbooleanArray>(env, ret);
280 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0;
281 static ScopedJavaLocalRef<jcharArray> Java_TestJni_returnCharArray(JNIEnv* env,
283 /* Must call RegisterNativesImpl() */
284 CHECK_CLAZZ(env, obj,
285 TestJni_clazz(env), NULL);
286 jmethodID method_id =
287 base::android::MethodID::LazyGet<
288 base::android::MethodID::TYPE_INSTANCE>(
289 env, TestJni_clazz(env),
295 &g_TestJni_returnCharArray);
298 static_cast<jcharArray>(env->CallObjectMethod(obj,
300 jni_generator::CheckException(env);
301 return ScopedJavaLocalRef<jcharArray>(env, ret);
304 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0;
305 static ScopedJavaLocalRef<jshortArray> Java_TestJni_returnShortArray(JNIEnv*
307 /* Must call RegisterNativesImpl() */
308 CHECK_CLAZZ(env, obj,
309 TestJni_clazz(env), NULL);
310 jmethodID method_id =
311 base::android::MethodID::LazyGet<
312 base::android::MethodID::TYPE_INSTANCE>(
313 env, TestJni_clazz(env),
319 &g_TestJni_returnShortArray);
322 static_cast<jshortArray>(env->CallObjectMethod(obj,
324 jni_generator::CheckException(env);
325 return ScopedJavaLocalRef<jshortArray>(env, ret);
328 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0;
329 static ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArray(JNIEnv* env,
331 /* Must call RegisterNativesImpl() */
332 CHECK_CLAZZ(env, obj,
333 TestJni_clazz(env), NULL);
334 jmethodID method_id =
335 base::android::MethodID::LazyGet<
336 base::android::MethodID::TYPE_INSTANCE>(
337 env, TestJni_clazz(env),
343 &g_TestJni_returnIntArray);
346 static_cast<jintArray>(env->CallObjectMethod(obj,
348 jni_generator::CheckException(env);
349 return ScopedJavaLocalRef<jintArray>(env, ret);
352 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0;
353 static ScopedJavaLocalRef<jlongArray> Java_TestJni_returnLongArray(JNIEnv* env,
355 /* Must call RegisterNativesImpl() */
356 CHECK_CLAZZ(env, obj,
357 TestJni_clazz(env), NULL);
358 jmethodID method_id =
359 base::android::MethodID::LazyGet<
360 base::android::MethodID::TYPE_INSTANCE>(
361 env, TestJni_clazz(env),
367 &g_TestJni_returnLongArray);
370 static_cast<jlongArray>(env->CallObjectMethod(obj,
372 jni_generator::CheckException(env);
373 return ScopedJavaLocalRef<jlongArray>(env, ret);
376 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0;
377 static ScopedJavaLocalRef<jdoubleArray> Java_TestJni_returnDoubleArray(JNIEnv*
379 /* Must call RegisterNativesImpl() */
380 CHECK_CLAZZ(env, obj,
381 TestJni_clazz(env), NULL);
382 jmethodID method_id =
383 base::android::MethodID::LazyGet<
384 base::android::MethodID::TYPE_INSTANCE>(
385 env, TestJni_clazz(env),
391 &g_TestJni_returnDoubleArray);
394 static_cast<jdoubleArray>(env->CallObjectMethod(obj,
396 jni_generator::CheckException(env);
397 return ScopedJavaLocalRef<jdoubleArray>(env, ret);
400 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0;
401 static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv*
403 /* Must call RegisterNativesImpl() */
404 CHECK_CLAZZ(env, obj,
405 TestJni_clazz(env), NULL);
406 jmethodID method_id =
407 base::android::MethodID::LazyGet<
408 base::android::MethodID::TYPE_INSTANCE>(
409 env, TestJni_clazz(env),
414 "[Ljava/lang/Object;",
415 &g_TestJni_returnObjectArray);
418 static_cast<jobjectArray>(env->CallObjectMethod(obj,
420 jni_generator::CheckException(env);
421 return ScopedJavaLocalRef<jobjectArray>(env, ret);
424 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0;
425 static ScopedJavaLocalRef<jobjectArray>
426 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
427 /* Must call RegisterNativesImpl() */
428 CHECK_CLAZZ(env, obj,
429 TestJni_clazz(env), NULL);
430 jmethodID method_id =
431 base::android::MethodID::LazyGet<
432 base::android::MethodID::TYPE_INSTANCE>(
433 env, TestJni_clazz(env),
434 "returnArrayOfByteArray",
439 &g_TestJni_returnArrayOfByteArray);
442 static_cast<jobjectArray>(env->CallObjectMethod(obj,
444 jni_generator::CheckException(env);
445 return ScopedJavaLocalRef<jobjectArray>(env, ret);
448 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0;
449 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env,
451 /* Must call RegisterNativesImpl() */
452 CHECK_CLAZZ(env, obj,
453 TestJni_clazz(env), NULL);
454 jmethodID method_id =
455 base::android::MethodID::LazyGet<
456 base::android::MethodID::TYPE_INSTANCE>(
457 env, TestJni_clazz(env),
462 "Landroid/graphics/Bitmap$CompressFormat;",
463 &g_TestJni_getCompressFormat);
466 env->CallObjectMethod(obj,
468 jni_generator::CheckException(env);
469 return ScopedJavaLocalRef<jobject>(env, ret);
472 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0;
473 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv*
475 /* Must call RegisterNativesImpl() */
476 CHECK_CLAZZ(env, obj,
477 TestJni_clazz(env), NULL);
478 jmethodID method_id =
479 base::android::MethodID::LazyGet<
480 base::android::MethodID::TYPE_INSTANCE>(
481 env, TestJni_clazz(env),
482 "getCompressFormatList",
487 &g_TestJni_getCompressFormatList);
490 env->CallObjectMethod(obj,
492 jni_generator::CheckException(env);
493 return ScopedJavaLocalRef<jobject>(env, ret);
496 // Step 3: RegisterNatives.
498 static bool RegisterNativesImpl(JNIEnv* env) {
500 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
501 base::android::GetClass(env, kTestJniClassPath).obj()));
502 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
503 base::android::GetClass(env, kInfoBarClassPath).obj()));
508 #endif // org_chromium_TestJni_JNI