// 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 #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 // Step 2: method stubs. static jint Init(JNIEnv* env, const JavaParamRef& jcaller); static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) { return Init(env, JavaParamRef(env, jcaller)); } static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env, jobject jcaller, jint nativeChromeBrowserProvider) { ChromeBrowserProvider* native = reinterpret_cast(nativeChromeBrowserProvider); CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); return native->Destroy(env, JavaParamRef(env, jcaller)); } static jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env, jobject jcaller, jint nativeChromeBrowserProvider, jstring url, jstring title, jboolean isFolder, jlong parentId) { ChromeBrowserProvider* native = reinterpret_cast(nativeChromeBrowserProvider); CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); return native->AddBookmark(env, JavaParamRef(env, jcaller), JavaParamRef(env, url), JavaParamRef(env, title), isFolder, parentId); } static ScopedJavaLocalRef GetDomainAndRegistry(JNIEnv* env, const JavaParamRef& jcaller, const JavaParamRef& url); static jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env, jclass jcaller, jstring url) { return GetDomainAndRegistry(env, JavaParamRef(env, jcaller), JavaParamRef(env, url)).Release(); } static void CreateHistoricalTabFromState(JNIEnv* env, const JavaParamRef& jcaller, const JavaParamRef& state, jint tab_index); static void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv* env, jclass jcaller, jbyteArray state, jint tab_index) { return CreateHistoricalTabFromState(env, JavaParamRef(env, jcaller), JavaParamRef(env, state), tab_index); } static ScopedJavaLocalRef GetStateAsByteArray(JNIEnv* env, const JavaParamRef& jcaller, const JavaParamRef& view); static jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv* env, jobject jcaller, jobject view) { return GetStateAsByteArray(env, JavaParamRef(env, jcaller), JavaParamRef(env, view)).Release(); } static ScopedJavaLocalRef GetAutofillProfileGUIDs(JNIEnv* env, const JavaParamRef& jcaller); static jobjectArray Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller) { return GetAutofillProfileGUIDs(env, JavaParamRef(env, jcaller)).Release(); } static void SetRecognitionResults(JNIEnv* env, const JavaParamRef& jcaller, jint sessionId, const JavaParamRef& results); static void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env, jobject jcaller, jint sessionId, jobjectArray results) { return SetRecognitionResults(env, JavaParamRef(env, jcaller), sessionId, JavaParamRef(env, results)); } static jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env, jobject jcaller, jint nativeChromeBrowserProvider, jstring url, jobject created, jobject isBookmark, jobject date, jbyteArray favicon, jstring title, jobject visits) { ChromeBrowserProvider* native = reinterpret_cast(nativeChromeBrowserProvider); CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); return native->AddBookmarkFromAPI(env, JavaParamRef(env, jcaller), JavaParamRef(env, url), JavaParamRef(env, created), JavaParamRef(env, isBookmark), JavaParamRef(env, date), JavaParamRef(env, favicon), JavaParamRef(env, title), JavaParamRef(env, visits)); } static jint FindAll(JNIEnv* env, const JavaParamRef& jcaller, const JavaParamRef& find); static jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject jcaller, jstring find) { return FindAll(env, JavaParamRef(env, jcaller), JavaParamRef(env, find)); } static ScopedJavaLocalRef GetInnerClass(JNIEnv* env, const JavaParamRef& jcaller); static jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass jcaller) { return GetInnerClass(env, JavaParamRef(env, jcaller)).Release(); } static jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env, jobject jcaller, jint nativeChromeBrowserProvider, jobjectArray projection, jstring selection, jobjectArray selectionArgs, jstring sortOrder) { ChromeBrowserProvider* native = reinterpret_cast(nativeChromeBrowserProvider); CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); return native->QueryBitmap(env, JavaParamRef(env, jcaller), JavaParamRef(env, projection), JavaParamRef(env, selection), JavaParamRef(env, selectionArgs), JavaParamRef(env, sortOrder)).Release(); } static void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env, jobject jcaller, jint nativeDataFetcherImplAndroid, jdouble alpha, jdouble beta, jdouble gamma) { DataFetcherImplAndroid* native = reinterpret_cast(nativeDataFetcherImplAndroid); CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); return native->GotOrientation(env, JavaParamRef(env, jcaller), alpha, beta, gamma); } static ScopedJavaLocalRef MessWithJavaException(JNIEnv* env, const JavaParamRef& jcaller, const JavaParamRef& e); static jthrowable Java_org_chromium_TestJni_nativeMessWithJavaException(JNIEnv* env, jclass jcaller, jthrowable e) { return MessWithJavaException(env, JavaParamRef(env, jcaller), JavaParamRef(env, e)).Release(); } // Step 3: RegisterNatives. static const JNINativeMethod kMethodsTestJni[] = { { "nativeInit", "(" ")" "I", reinterpret_cast(Java_org_chromium_TestJni_nativeInit) }, { "nativeDestroy", "(" "I" ")" "V", reinterpret_cast(Java_org_chromium_TestJni_nativeDestroy) }, { "nativeAddBookmark", "(" "I" "Ljava/lang/String;" "Ljava/lang/String;" "Z" "J" ")" "J", reinterpret_cast(Java_org_chromium_TestJni_nativeAddBookmark) }, { "nativeGetDomainAndRegistry", "(" "Ljava/lang/String;" ")" "Ljava/lang/String;", reinterpret_cast(Java_org_chromium_TestJni_nativeGetDomainAndRegistry) }, { "nativeCreateHistoricalTabFromState", "(" "[B" "I" ")" "V", reinterpret_cast(Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState) }, { "nativeGetStateAsByteArray", "(" "Landroid/view/View;" ")" "[B", reinterpret_cast(Java_org_chromium_TestJni_nativeGetStateAsByteArray) }, { "nativeGetAutofillProfileGUIDs", "(" ")" "[Ljava/lang/String;", reinterpret_cast(Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs) }, { "nativeSetRecognitionResults", "(" "I" "[Ljava/lang/String;" ")" "V", reinterpret_cast(Java_org_chromium_TestJni_nativeSetRecognitionResults) }, { "nativeAddBookmarkFromAPI", "(" "I" "Ljava/lang/String;" "Ljava/lang/Long;" "Ljava/lang/Boolean;" "Ljava/lang/Long;" "[B" "Ljava/lang/String;" "Ljava/lang/Integer;" ")" "J", reinterpret_cast(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI) }, { "nativeFindAll", "(" "Ljava/lang/String;" ")" "I", reinterpret_cast(Java_org_chromium_TestJni_nativeFindAll) }, { "nativeGetInnerClass", "(" ")" "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;", reinterpret_cast(Java_org_chromium_TestJni_nativeGetInnerClass) }, { "nativeQueryBitmap", "(" "I" "[Ljava/lang/String;" "Ljava/lang/String;" "[Ljava/lang/String;" "Ljava/lang/String;" ")" "Landroid/graphics/Bitmap;", reinterpret_cast(Java_org_chromium_TestJni_nativeQueryBitmap) }, { "nativeGotOrientation", "(" "I" "D" "D" "D" ")" "V", reinterpret_cast(Java_org_chromium_TestJni_nativeGotOrientation) }, { "nativeMessWithJavaException", "(" "Ljava/lang/Throwable;" ")" "Ljava/lang/Throwable;", reinterpret_cast(Java_org_chromium_TestJni_nativeMessWithJavaException) }, }; static bool RegisterNativesImpl(JNIEnv* env) { g_TestJni_clazz = reinterpret_cast(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