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 base::android::ScopedJavaLocalRef<jobject>
36 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
42 /* Must call RegisterNativesImpl() */
44 TestJni_clazz(env), NULL);
46 base::android::MethodID::LazyGet<
47 base::android::MethodID::TYPE_INSTANCE>(
48 env, TestJni_clazz(env),
56 "Landroid/graphics/Bitmap;"
58 "Lorg/chromium/Foo$InnerClass;",
59 &g_TestJni_showConfirmInfoBar);
62 env->CallObjectMethod(obj,
63 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title,
65 jni_generator::CheckException(env);
66 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
69 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0;
70 static base::android::ScopedJavaLocalRef<jobject>
71 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
76 /* Must call RegisterNativesImpl() */
78 TestJni_clazz(env), NULL);
80 base::android::MethodID::LazyGet<
81 base::android::MethodID::TYPE_INSTANCE>(
82 env, TestJni_clazz(env),
83 "showAutoLoginInfoBar",
91 "Lorg/chromium/Foo$InnerClass;",
92 &g_TestJni_showAutoLoginInfoBar);
95 env->CallObjectMethod(obj,
96 method_id, as_jint(nativeInfoBar), realm, account, args);
97 jni_generator::CheckException(env);
98 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
101 static base::subtle::AtomicWord g_InfoBar_dismiss = 0;
102 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) {
103 /* Must call RegisterNativesImpl() */
104 CHECK_CLAZZ(env, obj,
106 jmethodID method_id =
107 base::android::MethodID::LazyGet<
108 base::android::MethodID::TYPE_INSTANCE>(
109 env, InfoBar_clazz(env),
117 env->CallVoidMethod(obj,
119 jni_generator::CheckException(env);
123 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0;
124 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view,
128 /* Must call RegisterNativesImpl() */
129 CHECK_CLAZZ(env, TestJni_clazz(env),
130 TestJni_clazz(env), false);
131 jmethodID method_id =
132 base::android::MethodID::LazyGet<
133 base::android::MethodID::TYPE_STATIC>(
134 env, TestJni_clazz(env),
135 "shouldShowAutoLogin",
138 "Landroid/view/View;"
144 &g_TestJni_shouldShowAutoLogin);
147 env->CallStaticBooleanMethod(TestJni_clazz(env),
148 method_id, view, realm, account, args);
149 jni_generator::CheckException(env);
153 static base::subtle::AtomicWord g_TestJni_openUrl = 0;
154 static base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv*
156 /* Must call RegisterNativesImpl() */
157 CHECK_CLAZZ(env, TestJni_clazz(env),
158 TestJni_clazz(env), NULL);
159 jmethodID method_id =
160 base::android::MethodID::LazyGet<
161 base::android::MethodID::TYPE_STATIC>(
162 env, TestJni_clazz(env),
168 "Ljava/io/InputStream;",
172 env->CallStaticObjectMethod(TestJni_clazz(env),
174 jni_generator::CheckException(env);
175 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
178 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0;
179 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj,
183 JniIntWrapper iPrimaryID,
184 JniIntWrapper iSecondaryID) {
185 /* Must call RegisterNativesImpl() */
186 CHECK_CLAZZ(env, obj,
188 jmethodID method_id =
189 base::android::MethodID::LazyGet<
190 base::android::MethodID::TYPE_INSTANCE>(
191 env, TestJni_clazz(env),
192 "activateHardwareAcceleration",
202 &g_TestJni_activateHardwareAcceleration);
204 env->CallVoidMethod(obj,
205 method_id, activated, as_jint(iPid), as_jint(iType),
206 as_jint(iPrimaryID), as_jint(iSecondaryID));
207 jni_generator::CheckException(env);
211 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0;
212 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, JniIntWrapper
214 /* Must call RegisterNativesImpl() */
215 CHECK_CLAZZ(env, obj,
217 jmethodID method_id =
218 base::android::MethodID::LazyGet<
219 base::android::MethodID::TYPE_INSTANCE>(
220 env, TestJni_clazz(env),
227 &g_TestJni_uncheckedCall);
229 env->CallVoidMethod(obj,
230 method_id, as_jint(iParam));
234 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0;
235 static base::android::ScopedJavaLocalRef<jbyteArray>
236 Java_TestJni_returnByteArray(JNIEnv* env, jobject obj) {
237 /* Must call RegisterNativesImpl() */
238 CHECK_CLAZZ(env, obj,
239 TestJni_clazz(env), NULL);
240 jmethodID method_id =
241 base::android::MethodID::LazyGet<
242 base::android::MethodID::TYPE_INSTANCE>(
243 env, TestJni_clazz(env),
249 &g_TestJni_returnByteArray);
252 static_cast<jbyteArray>(env->CallObjectMethod(obj,
254 jni_generator::CheckException(env);
255 return base::android::ScopedJavaLocalRef<jbyteArray>(env, ret);
258 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0;
259 static base::android::ScopedJavaLocalRef<jbooleanArray>
260 Java_TestJni_returnBooleanArray(JNIEnv* env, jobject obj) {
261 /* Must call RegisterNativesImpl() */
262 CHECK_CLAZZ(env, obj,
263 TestJni_clazz(env), NULL);
264 jmethodID method_id =
265 base::android::MethodID::LazyGet<
266 base::android::MethodID::TYPE_INSTANCE>(
267 env, TestJni_clazz(env),
268 "returnBooleanArray",
273 &g_TestJni_returnBooleanArray);
276 static_cast<jbooleanArray>(env->CallObjectMethod(obj,
278 jni_generator::CheckException(env);
279 return base::android::ScopedJavaLocalRef<jbooleanArray>(env, ret);
282 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0;
283 static base::android::ScopedJavaLocalRef<jcharArray>
284 Java_TestJni_returnCharArray(JNIEnv* env, jobject obj) {
285 /* Must call RegisterNativesImpl() */
286 CHECK_CLAZZ(env, obj,
287 TestJni_clazz(env), NULL);
288 jmethodID method_id =
289 base::android::MethodID::LazyGet<
290 base::android::MethodID::TYPE_INSTANCE>(
291 env, TestJni_clazz(env),
297 &g_TestJni_returnCharArray);
300 static_cast<jcharArray>(env->CallObjectMethod(obj,
302 jni_generator::CheckException(env);
303 return base::android::ScopedJavaLocalRef<jcharArray>(env, ret);
306 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0;
307 static base::android::ScopedJavaLocalRef<jshortArray>
308 Java_TestJni_returnShortArray(JNIEnv* env, jobject obj) {
309 /* Must call RegisterNativesImpl() */
310 CHECK_CLAZZ(env, obj,
311 TestJni_clazz(env), NULL);
312 jmethodID method_id =
313 base::android::MethodID::LazyGet<
314 base::android::MethodID::TYPE_INSTANCE>(
315 env, TestJni_clazz(env),
321 &g_TestJni_returnShortArray);
324 static_cast<jshortArray>(env->CallObjectMethod(obj,
326 jni_generator::CheckException(env);
327 return base::android::ScopedJavaLocalRef<jshortArray>(env, ret);
330 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0;
331 static base::android::ScopedJavaLocalRef<jintArray>
332 Java_TestJni_returnIntArray(JNIEnv* env, jobject obj) {
333 /* Must call RegisterNativesImpl() */
334 CHECK_CLAZZ(env, obj,
335 TestJni_clazz(env), NULL);
336 jmethodID method_id =
337 base::android::MethodID::LazyGet<
338 base::android::MethodID::TYPE_INSTANCE>(
339 env, TestJni_clazz(env),
345 &g_TestJni_returnIntArray);
348 static_cast<jintArray>(env->CallObjectMethod(obj,
350 jni_generator::CheckException(env);
351 return base::android::ScopedJavaLocalRef<jintArray>(env, ret);
354 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0;
355 static base::android::ScopedJavaLocalRef<jlongArray>
356 Java_TestJni_returnLongArray(JNIEnv* env, jobject obj) {
357 /* Must call RegisterNativesImpl() */
358 CHECK_CLAZZ(env, obj,
359 TestJni_clazz(env), NULL);
360 jmethodID method_id =
361 base::android::MethodID::LazyGet<
362 base::android::MethodID::TYPE_INSTANCE>(
363 env, TestJni_clazz(env),
369 &g_TestJni_returnLongArray);
372 static_cast<jlongArray>(env->CallObjectMethod(obj,
374 jni_generator::CheckException(env);
375 return base::android::ScopedJavaLocalRef<jlongArray>(env, ret);
378 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0;
379 static base::android::ScopedJavaLocalRef<jdoubleArray>
380 Java_TestJni_returnDoubleArray(JNIEnv* env, jobject obj) {
381 /* Must call RegisterNativesImpl() */
382 CHECK_CLAZZ(env, obj,
383 TestJni_clazz(env), NULL);
384 jmethodID method_id =
385 base::android::MethodID::LazyGet<
386 base::android::MethodID::TYPE_INSTANCE>(
387 env, TestJni_clazz(env),
393 &g_TestJni_returnDoubleArray);
396 static_cast<jdoubleArray>(env->CallObjectMethod(obj,
398 jni_generator::CheckException(env);
399 return base::android::ScopedJavaLocalRef<jdoubleArray>(env, ret);
402 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0;
403 static base::android::ScopedJavaLocalRef<jobjectArray>
404 Java_TestJni_returnObjectArray(JNIEnv* env, jobject obj) {
405 /* Must call RegisterNativesImpl() */
406 CHECK_CLAZZ(env, obj,
407 TestJni_clazz(env), NULL);
408 jmethodID method_id =
409 base::android::MethodID::LazyGet<
410 base::android::MethodID::TYPE_INSTANCE>(
411 env, TestJni_clazz(env),
416 "[Ljava/lang/Object;",
417 &g_TestJni_returnObjectArray);
420 static_cast<jobjectArray>(env->CallObjectMethod(obj,
422 jni_generator::CheckException(env);
423 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
426 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0;
427 static base::android::ScopedJavaLocalRef<jobjectArray>
428 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
429 /* Must call RegisterNativesImpl() */
430 CHECK_CLAZZ(env, obj,
431 TestJni_clazz(env), NULL);
432 jmethodID method_id =
433 base::android::MethodID::LazyGet<
434 base::android::MethodID::TYPE_INSTANCE>(
435 env, TestJni_clazz(env),
436 "returnArrayOfByteArray",
441 &g_TestJni_returnArrayOfByteArray);
444 static_cast<jobjectArray>(env->CallObjectMethod(obj,
446 jni_generator::CheckException(env);
447 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
450 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0;
451 static base::android::ScopedJavaLocalRef<jobject>
452 Java_TestJni_getCompressFormat(JNIEnv* env, jobject obj) {
453 /* Must call RegisterNativesImpl() */
454 CHECK_CLAZZ(env, obj,
455 TestJni_clazz(env), NULL);
456 jmethodID method_id =
457 base::android::MethodID::LazyGet<
458 base::android::MethodID::TYPE_INSTANCE>(
459 env, TestJni_clazz(env),
464 "Landroid/graphics/Bitmap$CompressFormat;",
465 &g_TestJni_getCompressFormat);
468 env->CallObjectMethod(obj,
470 jni_generator::CheckException(env);
471 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
474 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0;
475 static base::android::ScopedJavaLocalRef<jobject>
476 Java_TestJni_getCompressFormatList(JNIEnv* env, jobject obj) {
477 /* Must call RegisterNativesImpl() */
478 CHECK_CLAZZ(env, obj,
479 TestJni_clazz(env), NULL);
480 jmethodID method_id =
481 base::android::MethodID::LazyGet<
482 base::android::MethodID::TYPE_INSTANCE>(
483 env, TestJni_clazz(env),
484 "getCompressFormatList",
489 &g_TestJni_getCompressFormatList);
492 env->CallObjectMethod(obj,
494 jni_generator::CheckException(env);
495 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
498 // Step 3: RegisterNatives.
500 static bool RegisterNativesImpl(JNIEnv* env) {
502 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
503 base::android::GetClass(env, kTestJniClassPath).obj()));
504 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
505 base::android::GetClass(env, kInfoBarClassPath).obj()));
510 #endif // org_chromium_TestJni_JNI