OLD | NEW |
(Empty) | |
| 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. |
| 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_android.h" |
| 16 #include "base/android/scoped_java_ref.h" |
| 17 #include "base/basictypes.h" |
| 18 #include "base/logging.h" |
| 19 |
| 20 using base::android::ScopedJavaLocalRef; |
| 21 |
| 22 // Step 1: forward declarations. |
| 23 namespace { |
| 24 const char kTestJniClassPath[] = "org/chromium/TestJni"; |
| 25 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; |
| 26 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 27 jclass g_TestJni_clazz = NULL; |
| 28 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 29 jclass g_InfoBar_clazz = NULL; |
| 30 } // namespace |
| 31 |
| 32 // Step 2: method stubs. |
| 33 |
| 34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; |
| 35 static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env, |
| 36 jobject obj, jint nativeInfoBar, |
| 37 jstring buttonOk, |
| 38 jstring buttonCancel, |
| 39 jstring title, |
| 40 jobject icon) { |
| 41 /* Must call RegisterNativesImpl() */ |
| 42 DCHECK(g_TestJni_clazz); |
| 43 jmethodID method_id = |
| 44 base::android::MethodID::LazyGet< |
| 45 base::android::MethodID::TYPE_INSTANCE>( |
| 46 env, g_TestJni_clazz, |
| 47 "showConfirmInfoBar", |
| 48 |
| 49 "(" |
| 50 "I" |
| 51 "Ljava/lang/String;" |
| 52 "Ljava/lang/String;" |
| 53 "Ljava/lang/String;" |
| 54 "Landroid/graphics/Bitmap;" |
| 55 ")" |
| 56 "Lorg/chromium/Foo$InnerClass;", |
| 57 &g_TestJni_showConfirmInfoBar); |
| 58 |
| 59 jobject ret = |
| 60 env->CallObjectMethod(obj, |
| 61 method_id, nativeInfoBar, buttonOk, buttonCancel, title, icon); |
| 62 base::android::CheckException(env); |
| 63 return ScopedJavaLocalRef<jobject>(env, ret); |
| 64 } |
| 65 |
| 66 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; |
| 67 static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv* |
| 68 env, jobject obj, jint nativeInfoBar, |
| 69 jstring realm, |
| 70 jstring account, |
| 71 jstring args) { |
| 72 /* Must call RegisterNativesImpl() */ |
| 73 DCHECK(g_TestJni_clazz); |
| 74 jmethodID method_id = |
| 75 base::android::MethodID::LazyGet< |
| 76 base::android::MethodID::TYPE_INSTANCE>( |
| 77 env, g_TestJni_clazz, |
| 78 "showAutoLoginInfoBar", |
| 79 |
| 80 "(" |
| 81 "I" |
| 82 "Ljava/lang/String;" |
| 83 "Ljava/lang/String;" |
| 84 "Ljava/lang/String;" |
| 85 ")" |
| 86 "Lorg/chromium/Foo$InnerClass;", |
| 87 &g_TestJni_showAutoLoginInfoBar); |
| 88 |
| 89 jobject ret = |
| 90 env->CallObjectMethod(obj, |
| 91 method_id, nativeInfoBar, realm, account, args); |
| 92 base::android::CheckException(env); |
| 93 return ScopedJavaLocalRef<jobject>(env, ret); |
| 94 } |
| 95 |
| 96 static base::subtle::AtomicWord g_InfoBar_dismiss = 0; |
| 97 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { |
| 98 /* Must call RegisterNativesImpl() */ |
| 99 DCHECK(g_InfoBar_clazz); |
| 100 jmethodID method_id = |
| 101 base::android::MethodID::LazyGet< |
| 102 base::android::MethodID::TYPE_INSTANCE>( |
| 103 env, g_InfoBar_clazz, |
| 104 "dismiss", |
| 105 |
| 106 "(" |
| 107 ")" |
| 108 "V", |
| 109 &g_InfoBar_dismiss); |
| 110 |
| 111 env->CallVoidMethod(obj, |
| 112 method_id); |
| 113 base::android::CheckException(env); |
| 114 |
| 115 } |
| 116 |
| 117 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; |
| 118 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, |
| 119 jstring realm, |
| 120 jstring account, |
| 121 jstring args) { |
| 122 /* Must call RegisterNativesImpl() */ |
| 123 DCHECK(g_TestJni_clazz); |
| 124 jmethodID method_id = |
| 125 base::android::MethodID::LazyGet< |
| 126 base::android::MethodID::TYPE_STATIC>( |
| 127 env, g_TestJni_clazz, |
| 128 "shouldShowAutoLogin", |
| 129 |
| 130 "(" |
| 131 "Landroid/view/View;" |
| 132 "Ljava/lang/String;" |
| 133 "Ljava/lang/String;" |
| 134 "Ljava/lang/String;" |
| 135 ")" |
| 136 "Z", |
| 137 &g_TestJni_shouldShowAutoLogin); |
| 138 |
| 139 jboolean ret = |
| 140 env->CallStaticBooleanMethod(g_TestJni_clazz, |
| 141 method_id, view, realm, account, args); |
| 142 base::android::CheckException(env); |
| 143 return ret; |
| 144 } |
| 145 |
| 146 static base::subtle::AtomicWord g_TestJni_openUrl = 0; |
| 147 static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring |
| 148 url) { |
| 149 /* Must call RegisterNativesImpl() */ |
| 150 DCHECK(g_TestJni_clazz); |
| 151 jmethodID method_id = |
| 152 base::android::MethodID::LazyGet< |
| 153 base::android::MethodID::TYPE_STATIC>( |
| 154 env, g_TestJni_clazz, |
| 155 "openUrl", |
| 156 |
| 157 "(" |
| 158 "Ljava/lang/String;" |
| 159 ")" |
| 160 "Ljava/io/InputStream;", |
| 161 &g_TestJni_openUrl); |
| 162 |
| 163 jobject ret = |
| 164 env->CallStaticObjectMethod(g_TestJni_clazz, |
| 165 method_id, url); |
| 166 base::android::CheckException(env); |
| 167 return ScopedJavaLocalRef<jobject>(env, ret); |
| 168 } |
| 169 |
| 170 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; |
| 171 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, |
| 172 jboolean activated, |
| 173 jint iPid, |
| 174 jint iType, |
| 175 jint iPrimaryID, |
| 176 jint iSecondaryID) { |
| 177 /* Must call RegisterNativesImpl() */ |
| 178 DCHECK(g_TestJni_clazz); |
| 179 jmethodID method_id = |
| 180 base::android::MethodID::LazyGet< |
| 181 base::android::MethodID::TYPE_INSTANCE>( |
| 182 env, g_TestJni_clazz, |
| 183 "activateHardwareAcceleration", |
| 184 |
| 185 "(" |
| 186 "Z" |
| 187 "I" |
| 188 "I" |
| 189 "I" |
| 190 "I" |
| 191 ")" |
| 192 "V", |
| 193 &g_TestJni_activateHardwareAcceleration); |
| 194 |
| 195 env->CallVoidMethod(obj, |
| 196 method_id, activated, iPid, iType, iPrimaryID, iSecondaryID); |
| 197 base::android::CheckException(env); |
| 198 |
| 199 } |
| 200 |
| 201 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; |
| 202 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, jint iParam) { |
| 203 /* Must call RegisterNativesImpl() */ |
| 204 DCHECK(g_TestJni_clazz); |
| 205 jmethodID method_id = |
| 206 base::android::MethodID::LazyGet< |
| 207 base::android::MethodID::TYPE_INSTANCE>( |
| 208 env, g_TestJni_clazz, |
| 209 "uncheckedCall", |
| 210 |
| 211 "(" |
| 212 "I" |
| 213 ")" |
| 214 "V", |
| 215 &g_TestJni_uncheckedCall); |
| 216 |
| 217 env->CallVoidMethod(obj, |
| 218 method_id, iParam); |
| 219 |
| 220 } |
| 221 |
| 222 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; |
| 223 static ScopedJavaLocalRef<jbyteArray> Java_TestJni_returnByteArray(JNIEnv* env, |
| 224 jobject obj) { |
| 225 /* Must call RegisterNativesImpl() */ |
| 226 DCHECK(g_TestJni_clazz); |
| 227 jmethodID method_id = |
| 228 base::android::MethodID::LazyGet< |
| 229 base::android::MethodID::TYPE_INSTANCE>( |
| 230 env, g_TestJni_clazz, |
| 231 "returnByteArray", |
| 232 |
| 233 "(" |
| 234 ")" |
| 235 "[B", |
| 236 &g_TestJni_returnByteArray); |
| 237 |
| 238 jbyteArray ret = |
| 239 static_cast<jbyteArray>(env->CallObjectMethod(obj, |
| 240 method_id)); |
| 241 base::android::CheckException(env); |
| 242 return ScopedJavaLocalRef<jbyteArray>(env, ret); |
| 243 } |
| 244 |
| 245 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; |
| 246 static ScopedJavaLocalRef<jbooleanArray> Java_TestJni_returnBooleanArray(JNIEnv* |
| 247 env, jobject obj) { |
| 248 /* Must call RegisterNativesImpl() */ |
| 249 DCHECK(g_TestJni_clazz); |
| 250 jmethodID method_id = |
| 251 base::android::MethodID::LazyGet< |
| 252 base::android::MethodID::TYPE_INSTANCE>( |
| 253 env, g_TestJni_clazz, |
| 254 "returnBooleanArray", |
| 255 |
| 256 "(" |
| 257 ")" |
| 258 "[Z", |
| 259 &g_TestJni_returnBooleanArray); |
| 260 |
| 261 jbooleanArray ret = |
| 262 static_cast<jbooleanArray>(env->CallObjectMethod(obj, |
| 263 method_id)); |
| 264 base::android::CheckException(env); |
| 265 return ScopedJavaLocalRef<jbooleanArray>(env, ret); |
| 266 } |
| 267 |
| 268 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; |
| 269 static ScopedJavaLocalRef<jcharArray> Java_TestJni_returnCharArray(JNIEnv* env, |
| 270 jobject obj) { |
| 271 /* Must call RegisterNativesImpl() */ |
| 272 DCHECK(g_TestJni_clazz); |
| 273 jmethodID method_id = |
| 274 base::android::MethodID::LazyGet< |
| 275 base::android::MethodID::TYPE_INSTANCE>( |
| 276 env, g_TestJni_clazz, |
| 277 "returnCharArray", |
| 278 |
| 279 "(" |
| 280 ")" |
| 281 "[C", |
| 282 &g_TestJni_returnCharArray); |
| 283 |
| 284 jcharArray ret = |
| 285 static_cast<jcharArray>(env->CallObjectMethod(obj, |
| 286 method_id)); |
| 287 base::android::CheckException(env); |
| 288 return ScopedJavaLocalRef<jcharArray>(env, ret); |
| 289 } |
| 290 |
| 291 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; |
| 292 static ScopedJavaLocalRef<jshortArray> Java_TestJni_returnShortArray(JNIEnv* |
| 293 env, jobject obj) { |
| 294 /* Must call RegisterNativesImpl() */ |
| 295 DCHECK(g_TestJni_clazz); |
| 296 jmethodID method_id = |
| 297 base::android::MethodID::LazyGet< |
| 298 base::android::MethodID::TYPE_INSTANCE>( |
| 299 env, g_TestJni_clazz, |
| 300 "returnShortArray", |
| 301 |
| 302 "(" |
| 303 ")" |
| 304 "[S", |
| 305 &g_TestJni_returnShortArray); |
| 306 |
| 307 jshortArray ret = |
| 308 static_cast<jshortArray>(env->CallObjectMethod(obj, |
| 309 method_id)); |
| 310 base::android::CheckException(env); |
| 311 return ScopedJavaLocalRef<jshortArray>(env, ret); |
| 312 } |
| 313 |
| 314 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; |
| 315 static ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArray(JNIEnv* env, |
| 316 jobject obj) { |
| 317 /* Must call RegisterNativesImpl() */ |
| 318 DCHECK(g_TestJni_clazz); |
| 319 jmethodID method_id = |
| 320 base::android::MethodID::LazyGet< |
| 321 base::android::MethodID::TYPE_INSTANCE>( |
| 322 env, g_TestJni_clazz, |
| 323 "returnIntArray", |
| 324 |
| 325 "(" |
| 326 ")" |
| 327 "[I", |
| 328 &g_TestJni_returnIntArray); |
| 329 |
| 330 jintArray ret = |
| 331 static_cast<jintArray>(env->CallObjectMethod(obj, |
| 332 method_id)); |
| 333 base::android::CheckException(env); |
| 334 return ScopedJavaLocalRef<jintArray>(env, ret); |
| 335 } |
| 336 |
| 337 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; |
| 338 static ScopedJavaLocalRef<jlongArray> Java_TestJni_returnLongArray(JNIEnv* env, |
| 339 jobject obj) { |
| 340 /* Must call RegisterNativesImpl() */ |
| 341 DCHECK(g_TestJni_clazz); |
| 342 jmethodID method_id = |
| 343 base::android::MethodID::LazyGet< |
| 344 base::android::MethodID::TYPE_INSTANCE>( |
| 345 env, g_TestJni_clazz, |
| 346 "returnLongArray", |
| 347 |
| 348 "(" |
| 349 ")" |
| 350 "[J", |
| 351 &g_TestJni_returnLongArray); |
| 352 |
| 353 jlongArray ret = |
| 354 static_cast<jlongArray>(env->CallObjectMethod(obj, |
| 355 method_id)); |
| 356 base::android::CheckException(env); |
| 357 return ScopedJavaLocalRef<jlongArray>(env, ret); |
| 358 } |
| 359 |
| 360 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; |
| 361 static ScopedJavaLocalRef<jdoubleArray> Java_TestJni_returnDoubleArray(JNIEnv* |
| 362 env, jobject obj) { |
| 363 /* Must call RegisterNativesImpl() */ |
| 364 DCHECK(g_TestJni_clazz); |
| 365 jmethodID method_id = |
| 366 base::android::MethodID::LazyGet< |
| 367 base::android::MethodID::TYPE_INSTANCE>( |
| 368 env, g_TestJni_clazz, |
| 369 "returnDoubleArray", |
| 370 |
| 371 "(" |
| 372 ")" |
| 373 "[D", |
| 374 &g_TestJni_returnDoubleArray); |
| 375 |
| 376 jdoubleArray ret = |
| 377 static_cast<jdoubleArray>(env->CallObjectMethod(obj, |
| 378 method_id)); |
| 379 base::android::CheckException(env); |
| 380 return ScopedJavaLocalRef<jdoubleArray>(env, ret); |
| 381 } |
| 382 |
| 383 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; |
| 384 static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv* |
| 385 env, jobject obj) { |
| 386 /* Must call RegisterNativesImpl() */ |
| 387 DCHECK(g_TestJni_clazz); |
| 388 jmethodID method_id = |
| 389 base::android::MethodID::LazyGet< |
| 390 base::android::MethodID::TYPE_INSTANCE>( |
| 391 env, g_TestJni_clazz, |
| 392 "returnObjectArray", |
| 393 |
| 394 "(" |
| 395 ")" |
| 396 "[Ljava/lang/Object;", |
| 397 &g_TestJni_returnObjectArray); |
| 398 |
| 399 jobjectArray ret = |
| 400 static_cast<jobjectArray>(env->CallObjectMethod(obj, |
| 401 method_id)); |
| 402 base::android::CheckException(env); |
| 403 return ScopedJavaLocalRef<jobjectArray>(env, ret); |
| 404 } |
| 405 |
| 406 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; |
| 407 static ScopedJavaLocalRef<jobjectArray> |
| 408 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) { |
| 409 /* Must call RegisterNativesImpl() */ |
| 410 DCHECK(g_TestJni_clazz); |
| 411 jmethodID method_id = |
| 412 base::android::MethodID::LazyGet< |
| 413 base::android::MethodID::TYPE_INSTANCE>( |
| 414 env, g_TestJni_clazz, |
| 415 "returnArrayOfByteArray", |
| 416 |
| 417 "(" |
| 418 ")" |
| 419 "[[B", |
| 420 &g_TestJni_returnArrayOfByteArray); |
| 421 |
| 422 jobjectArray ret = |
| 423 static_cast<jobjectArray>(env->CallObjectMethod(obj, |
| 424 method_id)); |
| 425 base::android::CheckException(env); |
| 426 return ScopedJavaLocalRef<jobjectArray>(env, ret); |
| 427 } |
| 428 |
| 429 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; |
| 430 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env, |
| 431 jobject obj) { |
| 432 /* Must call RegisterNativesImpl() */ |
| 433 DCHECK(g_TestJni_clazz); |
| 434 jmethodID method_id = |
| 435 base::android::MethodID::LazyGet< |
| 436 base::android::MethodID::TYPE_INSTANCE>( |
| 437 env, g_TestJni_clazz, |
| 438 "getCompressFormat", |
| 439 |
| 440 "(" |
| 441 ")" |
| 442 "Landroid/graphics/Bitmap$CompressFormat;", |
| 443 &g_TestJni_getCompressFormat); |
| 444 |
| 445 jobject ret = |
| 446 env->CallObjectMethod(obj, |
| 447 method_id); |
| 448 base::android::CheckException(env); |
| 449 return ScopedJavaLocalRef<jobject>(env, ret); |
| 450 } |
| 451 |
| 452 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; |
| 453 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv* |
| 454 env, jobject obj) { |
| 455 /* Must call RegisterNativesImpl() */ |
| 456 DCHECK(g_TestJni_clazz); |
| 457 jmethodID method_id = |
| 458 base::android::MethodID::LazyGet< |
| 459 base::android::MethodID::TYPE_INSTANCE>( |
| 460 env, g_TestJni_clazz, |
| 461 "getCompressFormatList", |
| 462 |
| 463 "(" |
| 464 ")" |
| 465 "Ljava/util/List;", |
| 466 &g_TestJni_getCompressFormatList); |
| 467 |
| 468 jobject ret = |
| 469 env->CallObjectMethod(obj, |
| 470 method_id); |
| 471 base::android::CheckException(env); |
| 472 return ScopedJavaLocalRef<jobject>(env, ret); |
| 473 } |
| 474 |
| 475 // Step 3: RegisterNatives. |
| 476 |
| 477 static bool RegisterNativesImpl(JNIEnv* env) { |
| 478 |
| 479 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
| 480 base::android::GetClass(env, kTestJniClassPath).obj())); |
| 481 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
| 482 base::android::GetClass(env, kInfoBarClassPath).obj())); |
| 483 return true; |
| 484 } |
| 485 |
| 486 #endif // org_chromium_TestJni_JNI |
OLD | NEW |