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 5// This file is autogenerated by 6// base/android/jni_generator/jni_generator.py 7// For 8// org/chromium/TestJni 9 10#ifndef org_chromium_TestJni_JNI 11#define org_chromium_TestJni_JNI 12 13#include <jni.h> 14 15#include "base/android/jni_generator/jni_generator_helper.h" 16 17#include "base/android/jni_int_wrapper.h" 18 19// Step 1: forward declarations. 20namespace { 21const char kTestJniClassPath[] = "org/chromium/TestJni"; 22const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; 23// Leaking this jclass as we cannot use LazyInstance from some threads. 24jclass g_TestJni_clazz = NULL; 25#define TestJni_clazz(env) g_TestJni_clazz 26// Leaking this jclass as we cannot use LazyInstance from some threads. 27jclass g_InfoBar_clazz = NULL; 28#define InfoBar_clazz(env) g_InfoBar_clazz 29 30} // namespace 31 32// Step 2: method stubs. 33 34static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; 35static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env, 36 jobject obj, JniIntWrapper nativeInfoBar, 37 jstring buttonOk, 38 jstring buttonCancel, 39 jstring title, 40 jobject icon) { 41 /* Must call RegisterNativesImpl() */ 42 CHECK_CLAZZ(env, obj, 43 TestJni_clazz(env), NULL); 44 jmethodID method_id = 45 base::android::MethodID::LazyGet< 46 base::android::MethodID::TYPE_INSTANCE>( 47 env, TestJni_clazz(env), 48 "showConfirmInfoBar", 49 50"(" 51"I" 52"Ljava/lang/String;" 53"Ljava/lang/String;" 54"Ljava/lang/String;" 55"Landroid/graphics/Bitmap;" 56")" 57"Lorg/chromium/Foo$InnerClass;", 58 &g_TestJni_showConfirmInfoBar); 59 60 jobject ret = 61 env->CallObjectMethod(obj, 62 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title, 63 icon); 64 jni_generator::CheckException(env); 65 return ScopedJavaLocalRef<jobject>(env, ret); 66} 67 68static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; 69static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv* 70 env, jobject obj, JniIntWrapper nativeInfoBar, 71 jstring realm, 72 jstring account, 73 jstring args) { 74 /* Must call RegisterNativesImpl() */ 75 CHECK_CLAZZ(env, obj, 76 TestJni_clazz(env), NULL); 77 jmethodID method_id = 78 base::android::MethodID::LazyGet< 79 base::android::MethodID::TYPE_INSTANCE>( 80 env, TestJni_clazz(env), 81 "showAutoLoginInfoBar", 82 83"(" 84"I" 85"Ljava/lang/String;" 86"Ljava/lang/String;" 87"Ljava/lang/String;" 88")" 89"Lorg/chromium/Foo$InnerClass;", 90 &g_TestJni_showAutoLoginInfoBar); 91 92 jobject ret = 93 env->CallObjectMethod(obj, 94 method_id, as_jint(nativeInfoBar), realm, account, args); 95 jni_generator::CheckException(env); 96 return ScopedJavaLocalRef<jobject>(env, ret); 97} 98 99static base::subtle::AtomicWord g_InfoBar_dismiss = 0; 100static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { 101 /* Must call RegisterNativesImpl() */ 102 CHECK_CLAZZ(env, obj, 103 InfoBar_clazz(env)); 104 jmethodID method_id = 105 base::android::MethodID::LazyGet< 106 base::android::MethodID::TYPE_INSTANCE>( 107 env, InfoBar_clazz(env), 108 "dismiss", 109 110"(" 111")" 112"V", 113 &g_InfoBar_dismiss); 114 115 env->CallVoidMethod(obj, 116 method_id); 117 jni_generator::CheckException(env); 118 119} 120 121static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; 122static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, 123 jstring realm, 124 jstring account, 125 jstring args) { 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", 134 135"(" 136"Landroid/view/View;" 137"Ljava/lang/String;" 138"Ljava/lang/String;" 139"Ljava/lang/String;" 140")" 141"Z", 142 &g_TestJni_shouldShowAutoLogin); 143 144 jboolean ret = 145 env->CallStaticBooleanMethod(TestJni_clazz(env), 146 method_id, view, realm, account, args); 147 jni_generator::CheckException(env); 148 return ret; 149} 150 151static base::subtle::AtomicWord g_TestJni_openUrl = 0; 152static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring 153 url) { 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), 161 "openUrl", 162 163"(" 164"Ljava/lang/String;" 165")" 166"Ljava/io/InputStream;", 167 &g_TestJni_openUrl); 168 169 jobject ret = 170 env->CallStaticObjectMethod(TestJni_clazz(env), 171 method_id, url); 172 jni_generator::CheckException(env); 173 return ScopedJavaLocalRef<jobject>(env, ret); 174} 175 176static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; 177static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, 178 jboolean activated, 179 JniIntWrapper iPid, 180 JniIntWrapper iType, 181 JniIntWrapper iPrimaryID, 182 JniIntWrapper iSecondaryID) { 183 /* Must call RegisterNativesImpl() */ 184 CHECK_CLAZZ(env, obj, 185 TestJni_clazz(env)); 186 jmethodID method_id = 187 base::android::MethodID::LazyGet< 188 base::android::MethodID::TYPE_INSTANCE>( 189 env, TestJni_clazz(env), 190 "activateHardwareAcceleration", 191 192"(" 193"Z" 194"I" 195"I" 196"I" 197"I" 198")" 199"V", 200 &g_TestJni_activateHardwareAcceleration); 201 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); 206 207} 208 209static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; 210static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, JniIntWrapper 211 iParam) { 212 /* Must call RegisterNativesImpl() */ 213 CHECK_CLAZZ(env, obj, 214 TestJni_clazz(env)); 215 jmethodID method_id = 216 base::android::MethodID::LazyGet< 217 base::android::MethodID::TYPE_INSTANCE>( 218 env, TestJni_clazz(env), 219 "uncheckedCall", 220 221"(" 222"I" 223")" 224"V", 225 &g_TestJni_uncheckedCall); 226 227 env->CallVoidMethod(obj, 228 method_id, as_jint(iParam)); 229 230} 231 232static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; 233static ScopedJavaLocalRef<jbyteArray> Java_TestJni_returnByteArray(JNIEnv* env, 234 jobject obj) { 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), 242 "returnByteArray", 243 244"(" 245")" 246"[B", 247 &g_TestJni_returnByteArray); 248 249 jbyteArray ret = 250 static_cast<jbyteArray>(env->CallObjectMethod(obj, 251 method_id)); 252 jni_generator::CheckException(env); 253 return ScopedJavaLocalRef<jbyteArray>(env, ret); 254} 255 256static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; 257static ScopedJavaLocalRef<jbooleanArray> Java_TestJni_returnBooleanArray(JNIEnv* 258 env, jobject obj) { 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", 267 268"(" 269")" 270"[Z", 271 &g_TestJni_returnBooleanArray); 272 273 jbooleanArray ret = 274 static_cast<jbooleanArray>(env->CallObjectMethod(obj, 275 method_id)); 276 jni_generator::CheckException(env); 277 return ScopedJavaLocalRef<jbooleanArray>(env, ret); 278} 279 280static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; 281static ScopedJavaLocalRef<jcharArray> Java_TestJni_returnCharArray(JNIEnv* env, 282 jobject obj) { 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), 290 "returnCharArray", 291 292"(" 293")" 294"[C", 295 &g_TestJni_returnCharArray); 296 297 jcharArray ret = 298 static_cast<jcharArray>(env->CallObjectMethod(obj, 299 method_id)); 300 jni_generator::CheckException(env); 301 return ScopedJavaLocalRef<jcharArray>(env, ret); 302} 303 304static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; 305static ScopedJavaLocalRef<jshortArray> Java_TestJni_returnShortArray(JNIEnv* 306 env, jobject obj) { 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), 314 "returnShortArray", 315 316"(" 317")" 318"[S", 319 &g_TestJni_returnShortArray); 320 321 jshortArray ret = 322 static_cast<jshortArray>(env->CallObjectMethod(obj, 323 method_id)); 324 jni_generator::CheckException(env); 325 return ScopedJavaLocalRef<jshortArray>(env, ret); 326} 327 328static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; 329static ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArray(JNIEnv* env, 330 jobject obj) { 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), 338 "returnIntArray", 339 340"(" 341")" 342"[I", 343 &g_TestJni_returnIntArray); 344 345 jintArray ret = 346 static_cast<jintArray>(env->CallObjectMethod(obj, 347 method_id)); 348 jni_generator::CheckException(env); 349 return ScopedJavaLocalRef<jintArray>(env, ret); 350} 351 352static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; 353static ScopedJavaLocalRef<jlongArray> Java_TestJni_returnLongArray(JNIEnv* env, 354 jobject obj) { 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), 362 "returnLongArray", 363 364"(" 365")" 366"[J", 367 &g_TestJni_returnLongArray); 368 369 jlongArray ret = 370 static_cast<jlongArray>(env->CallObjectMethod(obj, 371 method_id)); 372 jni_generator::CheckException(env); 373 return ScopedJavaLocalRef<jlongArray>(env, ret); 374} 375 376static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; 377static ScopedJavaLocalRef<jdoubleArray> Java_TestJni_returnDoubleArray(JNIEnv* 378 env, jobject obj) { 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), 386 "returnDoubleArray", 387 388"(" 389")" 390"[D", 391 &g_TestJni_returnDoubleArray); 392 393 jdoubleArray ret = 394 static_cast<jdoubleArray>(env->CallObjectMethod(obj, 395 method_id)); 396 jni_generator::CheckException(env); 397 return ScopedJavaLocalRef<jdoubleArray>(env, ret); 398} 399 400static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; 401static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv* 402 env, jobject obj) { 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), 410 "returnObjectArray", 411 412"(" 413")" 414"[Ljava/lang/Object;", 415 &g_TestJni_returnObjectArray); 416 417 jobjectArray ret = 418 static_cast<jobjectArray>(env->CallObjectMethod(obj, 419 method_id)); 420 jni_generator::CheckException(env); 421 return ScopedJavaLocalRef<jobjectArray>(env, ret); 422} 423 424static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; 425static 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", 435 436"(" 437")" 438"[[B", 439 &g_TestJni_returnArrayOfByteArray); 440 441 jobjectArray ret = 442 static_cast<jobjectArray>(env->CallObjectMethod(obj, 443 method_id)); 444 jni_generator::CheckException(env); 445 return ScopedJavaLocalRef<jobjectArray>(env, ret); 446} 447 448static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; 449static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env, 450 jobject obj) { 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), 458 "getCompressFormat", 459 460"(" 461")" 462"Landroid/graphics/Bitmap$CompressFormat;", 463 &g_TestJni_getCompressFormat); 464 465 jobject ret = 466 env->CallObjectMethod(obj, 467 method_id); 468 jni_generator::CheckException(env); 469 return ScopedJavaLocalRef<jobject>(env, ret); 470} 471 472static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; 473static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv* 474 env, jobject obj) { 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", 483 484"(" 485")" 486"Ljava/util/List;", 487 &g_TestJni_getCompressFormatList); 488 489 jobject ret = 490 env->CallObjectMethod(obj, 491 method_id); 492 jni_generator::CheckException(env); 493 return ScopedJavaLocalRef<jobject>(env, ret); 494} 495 496// Step 3: RegisterNatives. 497 498static bool RegisterNativesImpl(JNIEnv* env) { 499 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())); 504 505 return true; 506} 507 508#endif // org_chromium_TestJni_JNI 509