| // Copyright 2014 The Chromium Authors. All rights reserved. | 
 | // Use of this source code is governed by a BSD-style license that can be | 
 | // found in the LICENSE file. | 
 |  | 
 | // This file is autogenerated by | 
 | //     base/android/jni_generator/jni_generator.py | 
 | // For | 
 | //     org/chromium/TestJni | 
 |  | 
 | #ifndef org_chromium_TestJni_JNI | 
 | #define org_chromium_TestJni_JNI | 
 |  | 
 | #include <jni.h> | 
 |  | 
 | #include "base/android/jni_generator/jni_generator_helper.h" | 
 |  | 
 | #include "base/android/jni_int_wrapper.h" | 
 |  | 
 | // Step 1: forward declarations. | 
 | namespace { | 
 | const char kTestJniClassPath[] = "org/chromium/TestJni"; | 
 | // Leaking this jclass as we cannot use LazyInstance from some threads. | 
 | jclass g_TestJni_clazz = NULL; | 
 | #define TestJni_clazz(env) g_TestJni_clazz | 
 |  | 
 | }  // namespace | 
 |  | 
 | static jint Init(JNIEnv* env, jobject jcaller); | 
 |  | 
 | static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller, | 
 |     jstring url); | 
 |  | 
 | static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller, | 
 |     jbyteArray state, | 
 |     jint tab_index); | 
 |  | 
 | static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller, | 
 |     jobject view); | 
 |  | 
 | static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller); | 
 |  | 
 | static void SetRecognitionResults(JNIEnv* env, jobject jcaller, | 
 |     jint sessionId, | 
 |     jobjectArray results); | 
 |  | 
 | static jint FindAll(JNIEnv* env, jobject jcaller, | 
 |     jstring find); | 
 |  | 
 | static jobject GetInnerClass(JNIEnv* env, jclass jcaller); | 
 |  | 
 | // Step 2: method stubs. | 
 | static void Destroy(JNIEnv* env, jobject jcaller, | 
 |     jint nativeChromeBrowserProvider) { | 
 |   ChromeBrowserProvider* native = | 
 |       reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 
 |   CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); | 
 |   return native->Destroy(env, jcaller); | 
 | } | 
 |  | 
 | static jlong AddBookmark(JNIEnv* env, jobject jcaller, | 
 |     jint nativeChromeBrowserProvider, | 
 |     jstring url, | 
 |     jstring title, | 
 |     jboolean isFolder, | 
 |     jlong parentId) { | 
 |   ChromeBrowserProvider* native = | 
 |       reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 
 |   CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); | 
 |   return native->AddBookmark(env, jcaller, url, title, isFolder, parentId); | 
 | } | 
 |  | 
 | static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller, | 
 |     jint nativeChromeBrowserProvider, | 
 |     jstring url, | 
 |     jobject created, | 
 |     jobject isBookmark, | 
 |     jobject date, | 
 |     jbyteArray favicon, | 
 |     jstring title, | 
 |     jobject visits) { | 
 |   ChromeBrowserProvider* native = | 
 |       reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 
 |   CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); | 
 |   return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark, | 
 |       date, favicon, title, visits); | 
 | } | 
 |  | 
 | static jobject QueryBitmap(JNIEnv* env, jobject jcaller, | 
 |     jint nativeChromeBrowserProvider, | 
 |     jobjectArray projection, | 
 |     jstring selection, | 
 |     jobjectArray selectionArgs, | 
 |     jstring sortOrder) { | 
 |   ChromeBrowserProvider* native = | 
 |       reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 
 |   CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); | 
 |   return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs, | 
 |       sortOrder).Release(); | 
 | } | 
 |  | 
 | static void GotOrientation(JNIEnv* env, jobject jcaller, | 
 |     jint nativeDataFetcherImplAndroid, | 
 |     jdouble alpha, | 
 |     jdouble beta, | 
 |     jdouble gamma) { | 
 |   DataFetcherImplAndroid* native = | 
 |       reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); | 
 |   CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); | 
 |   return native->GotOrientation(env, jcaller, alpha, beta, gamma); | 
 | } | 
 |  | 
 | // Step 3: RegisterNatives. | 
 |  | 
 | static const JNINativeMethod kMethodsTestJni[] = { | 
 |     { "nativeInit", | 
 | "(" | 
 | ")" | 
 | "I", reinterpret_cast<void*>(Init) }, | 
 |     { "nativeDestroy", | 
 | "(" | 
 | "I" | 
 | ")" | 
 | "V", reinterpret_cast<void*>(Destroy) }, | 
 |     { "nativeAddBookmark", | 
 | "(" | 
 | "I" | 
 | "Ljava/lang/String;" | 
 | "Ljava/lang/String;" | 
 | "Z" | 
 | "J" | 
 | ")" | 
 | "J", reinterpret_cast<void*>(AddBookmark) }, | 
 |     { "nativeGetDomainAndRegistry", | 
 | "(" | 
 | "Ljava/lang/String;" | 
 | ")" | 
 | "Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) }, | 
 |     { "nativeCreateHistoricalTabFromState", | 
 | "(" | 
 | "[B" | 
 | "I" | 
 | ")" | 
 | "V", reinterpret_cast<void*>(CreateHistoricalTabFromState) }, | 
 |     { "nativeGetStateAsByteArray", | 
 | "(" | 
 | "Landroid/view/View;" | 
 | ")" | 
 | "[B", reinterpret_cast<void*>(GetStateAsByteArray) }, | 
 |     { "nativeGetAutofillProfileGUIDs", | 
 | "(" | 
 | ")" | 
 | "[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) }, | 
 |     { "nativeSetRecognitionResults", | 
 | "(" | 
 | "I" | 
 | "[Ljava/lang/String;" | 
 | ")" | 
 | "V", reinterpret_cast<void*>(SetRecognitionResults) }, | 
 |     { "nativeAddBookmarkFromAPI", | 
 | "(" | 
 | "I" | 
 | "Ljava/lang/String;" | 
 | "Ljava/lang/Long;" | 
 | "Ljava/lang/Boolean;" | 
 | "Ljava/lang/Long;" | 
 | "[B" | 
 | "Ljava/lang/String;" | 
 | "Ljava/lang/Integer;" | 
 | ")" | 
 | "J", reinterpret_cast<void*>(AddBookmarkFromAPI) }, | 
 |     { "nativeFindAll", | 
 | "(" | 
 | "Ljava/lang/String;" | 
 | ")" | 
 | "I", reinterpret_cast<void*>(FindAll) }, | 
 |     { "nativeGetInnerClass", | 
 | "(" | 
 | ")" | 
 | "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;", | 
 |     reinterpret_cast<void*>(GetInnerClass) }, | 
 |     { "nativeQueryBitmap", | 
 | "(" | 
 | "I" | 
 | "[Ljava/lang/String;" | 
 | "Ljava/lang/String;" | 
 | "[Ljava/lang/String;" | 
 | "Ljava/lang/String;" | 
 | ")" | 
 | "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) }, | 
 |     { "nativeGotOrientation", | 
 | "(" | 
 | "I" | 
 | "D" | 
 | "D" | 
 | "D" | 
 | ")" | 
 | "V", reinterpret_cast<void*>(GotOrientation) }, | 
 | }; | 
 |  | 
 | static bool RegisterNativesImpl(JNIEnv* env) { | 
 |   g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 
 |       base::android::GetClass(env, kTestJniClassPath).obj())); | 
 |  | 
 |   const int kMethodsTestJniSize = arraysize(kMethodsTestJni); | 
 |  | 
 |   if (env->RegisterNatives(TestJni_clazz(env), | 
 |                            kMethodsTestJni, | 
 |                            kMethodsTestJniSize) < 0) { | 
 |     jni_generator::HandleRegistrationError( | 
 |         env, TestJni_clazz(env), __FILE__); | 
 |     return false; | 
 |   } | 
 |  | 
 |   return true; | 
 | } | 
 |  | 
 | #endif  // org_chromium_TestJni_JNI |