1 // Copyright (c) 2012 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 // Leaking this jclass as we cannot use LazyInstance from some threads.
26 jclass g_InfoBar_clazz = NULL;
30 // Step 2: method stubs.
32 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0;
33 static base::android::ScopedJavaLocalRef<jobject>
34 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
40 /* Must call RegisterNativesImpl() */
42 g_TestJni_clazz, NULL);
44 base::android::MethodID::LazyGet<
45 base::android::MethodID::TYPE_INSTANCE>(
54 "Landroid/graphics/Bitmap;"
56 "Lorg/chromium/Foo$InnerClass;",
57 &g_TestJni_showConfirmInfoBar);
60 env->CallObjectMethod(obj,
61 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title,
63 jni_generator::CheckException(env);
64 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
67 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0;
68 static base::android::ScopedJavaLocalRef<jobject>
69 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
74 /* Must call RegisterNativesImpl() */
76 g_TestJni_clazz, NULL);
78 base::android::MethodID::LazyGet<
79 base::android::MethodID::TYPE_INSTANCE>(
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 base::android::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, g_InfoBar_clazz,
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, g_TestJni_clazz,
128 g_TestJni_clazz, false);
129 jmethodID method_id =
130 base::android::MethodID::LazyGet<
131 base::android::MethodID::TYPE_STATIC>(
132 env, g_TestJni_clazz,
133 "shouldShowAutoLogin",
136 "Landroid/view/View;"
142 &g_TestJni_shouldShowAutoLogin);
145 env->CallStaticBooleanMethod(g_TestJni_clazz,
146 method_id, view, realm, account, args);
147 jni_generator::CheckException(env);
151 static base::subtle::AtomicWord g_TestJni_openUrl = 0;
152 static base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv*
154 /* Must call RegisterNativesImpl() */
155 CHECK_CLAZZ(env, g_TestJni_clazz,
156 g_TestJni_clazz, NULL);
157 jmethodID method_id =
158 base::android::MethodID::LazyGet<
159 base::android::MethodID::TYPE_STATIC>(
160 env, g_TestJni_clazz,
166 "Ljava/io/InputStream;",
170 env->CallStaticObjectMethod(g_TestJni_clazz,
172 jni_generator::CheckException(env);
173 return base::android::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, g_TestJni_clazz,
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, g_TestJni_clazz,
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 base::android::ScopedJavaLocalRef<jbyteArray>
234 Java_TestJni_returnByteArray(JNIEnv* env, jobject obj) {
235 /* Must call RegisterNativesImpl() */
236 CHECK_CLAZZ(env, obj,
237 g_TestJni_clazz, NULL);
238 jmethodID method_id =
239 base::android::MethodID::LazyGet<
240 base::android::MethodID::TYPE_INSTANCE>(
241 env, g_TestJni_clazz,
247 &g_TestJni_returnByteArray);
250 static_cast<jbyteArray>(env->CallObjectMethod(obj,
252 jni_generator::CheckException(env);
253 return base::android::ScopedJavaLocalRef<jbyteArray>(env, ret);
256 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0;
257 static base::android::ScopedJavaLocalRef<jbooleanArray>
258 Java_TestJni_returnBooleanArray(JNIEnv* env, jobject obj) {
259 /* Must call RegisterNativesImpl() */
260 CHECK_CLAZZ(env, obj,
261 g_TestJni_clazz, NULL);
262 jmethodID method_id =
263 base::android::MethodID::LazyGet<
264 base::android::MethodID::TYPE_INSTANCE>(
265 env, g_TestJni_clazz,
266 "returnBooleanArray",
271 &g_TestJni_returnBooleanArray);
274 static_cast<jbooleanArray>(env->CallObjectMethod(obj,
276 jni_generator::CheckException(env);
277 return base::android::ScopedJavaLocalRef<jbooleanArray>(env, ret);
280 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0;
281 static base::android::ScopedJavaLocalRef<jcharArray>
282 Java_TestJni_returnCharArray(JNIEnv* env, jobject obj) {
283 /* Must call RegisterNativesImpl() */
284 CHECK_CLAZZ(env, obj,
285 g_TestJni_clazz, NULL);
286 jmethodID method_id =
287 base::android::MethodID::LazyGet<
288 base::android::MethodID::TYPE_INSTANCE>(
289 env, g_TestJni_clazz,
295 &g_TestJni_returnCharArray);
298 static_cast<jcharArray>(env->CallObjectMethod(obj,
300 jni_generator::CheckException(env);
301 return base::android::ScopedJavaLocalRef<jcharArray>(env, ret);
304 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0;
305 static base::android::ScopedJavaLocalRef<jshortArray>
306 Java_TestJni_returnShortArray(JNIEnv* env, jobject obj) {
307 /* Must call RegisterNativesImpl() */
308 CHECK_CLAZZ(env, obj,
309 g_TestJni_clazz, NULL);
310 jmethodID method_id =
311 base::android::MethodID::LazyGet<
312 base::android::MethodID::TYPE_INSTANCE>(
313 env, g_TestJni_clazz,
319 &g_TestJni_returnShortArray);
322 static_cast<jshortArray>(env->CallObjectMethod(obj,
324 jni_generator::CheckException(env);
325 return base::android::ScopedJavaLocalRef<jshortArray>(env, ret);
328 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0;
329 static base::android::ScopedJavaLocalRef<jintArray>
330 Java_TestJni_returnIntArray(JNIEnv* env, jobject obj) {
331 /* Must call RegisterNativesImpl() */
332 CHECK_CLAZZ(env, obj,
333 g_TestJni_clazz, NULL);
334 jmethodID method_id =
335 base::android::MethodID::LazyGet<
336 base::android::MethodID::TYPE_INSTANCE>(
337 env, g_TestJni_clazz,
343 &g_TestJni_returnIntArray);
346 static_cast<jintArray>(env->CallObjectMethod(obj,
348 jni_generator::CheckException(env);
349 return base::android::ScopedJavaLocalRef<jintArray>(env, ret);
352 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0;
353 static base::android::ScopedJavaLocalRef<jlongArray>
354 Java_TestJni_returnLongArray(JNIEnv* env, jobject obj) {
355 /* Must call RegisterNativesImpl() */
356 CHECK_CLAZZ(env, obj,
357 g_TestJni_clazz, NULL);
358 jmethodID method_id =
359 base::android::MethodID::LazyGet<
360 base::android::MethodID::TYPE_INSTANCE>(
361 env, g_TestJni_clazz,
367 &g_TestJni_returnLongArray);
370 static_cast<jlongArray>(env->CallObjectMethod(obj,
372 jni_generator::CheckException(env);
373 return base::android::ScopedJavaLocalRef<jlongArray>(env, ret);
376 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0;
377 static base::android::ScopedJavaLocalRef<jdoubleArray>
378 Java_TestJni_returnDoubleArray(JNIEnv* env, jobject obj) {
379 /* Must call RegisterNativesImpl() */
380 CHECK_CLAZZ(env, obj,
381 g_TestJni_clazz, NULL);
382 jmethodID method_id =
383 base::android::MethodID::LazyGet<
384 base::android::MethodID::TYPE_INSTANCE>(
385 env, g_TestJni_clazz,
391 &g_TestJni_returnDoubleArray);
394 static_cast<jdoubleArray>(env->CallObjectMethod(obj,
396 jni_generator::CheckException(env);
397 return base::android::ScopedJavaLocalRef<jdoubleArray>(env, ret);
400 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0;
401 static base::android::ScopedJavaLocalRef<jobjectArray>
402 Java_TestJni_returnObjectArray(JNIEnv* env, jobject obj) {
403 /* Must call RegisterNativesImpl() */
404 CHECK_CLAZZ(env, obj,
405 g_TestJni_clazz, NULL);
406 jmethodID method_id =
407 base::android::MethodID::LazyGet<
408 base::android::MethodID::TYPE_INSTANCE>(
409 env, g_TestJni_clazz,
414 "[Ljava/lang/Object;",
415 &g_TestJni_returnObjectArray);
418 static_cast<jobjectArray>(env->CallObjectMethod(obj,
420 jni_generator::CheckException(env);
421 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
424 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0;
425 static base::android::ScopedJavaLocalRef<jobjectArray>
426 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
427 /* Must call RegisterNativesImpl() */
428 CHECK_CLAZZ(env, obj,
429 g_TestJni_clazz, NULL);
430 jmethodID method_id =
431 base::android::MethodID::LazyGet<
432 base::android::MethodID::TYPE_INSTANCE>(
433 env, g_TestJni_clazz,
434 "returnArrayOfByteArray",
439 &g_TestJni_returnArrayOfByteArray);
442 static_cast<jobjectArray>(env->CallObjectMethod(obj,
444 jni_generator::CheckException(env);
445 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
448 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0;
449 static base::android::ScopedJavaLocalRef<jobject>
450 Java_TestJni_getCompressFormat(JNIEnv* env, jobject obj) {
451 /* Must call RegisterNativesImpl() */
452 CHECK_CLAZZ(env, obj,
453 g_TestJni_clazz, NULL);
454 jmethodID method_id =
455 base::android::MethodID::LazyGet<
456 base::android::MethodID::TYPE_INSTANCE>(
457 env, g_TestJni_clazz,
462 "Landroid/graphics/Bitmap$CompressFormat;",
463 &g_TestJni_getCompressFormat);
466 env->CallObjectMethod(obj,
468 jni_generator::CheckException(env);
469 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
472 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0;
473 static base::android::ScopedJavaLocalRef<jobject>
474 Java_TestJni_getCompressFormatList(JNIEnv* env, jobject obj) {
475 /* Must call RegisterNativesImpl() */
476 CHECK_CLAZZ(env, obj,
477 g_TestJni_clazz, NULL);
478 jmethodID method_id =
479 base::android::MethodID::LazyGet<
480 base::android::MethodID::TYPE_INSTANCE>(
481 env, g_TestJni_clazz,
482 "getCompressFormatList",
487 &g_TestJni_getCompressFormatList);
490 env->CallObjectMethod(obj,
492 jni_generator::CheckException(env);
493 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
496 // Step 3: RegisterNatives.
498 static bool RegisterNativesImpl(JNIEnv* env) {
499 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
500 base::android::GetClass(env, kTestJniClassPath).obj()));
501 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
502 base::android::GetClass(env, kInfoBarClassPath).obj()));
507 #endif // org_chromium_TestJni_JNI