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.
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 // Leaking this jclass as we cannot use LazyInstance from some threads.
23 jclass g_TestJni_clazz = NULL;
24 #define TestJni_clazz(env) g_TestJni_clazz
28 // Step 2: method stubs.
30 static jint Init(JNIEnv* env, const JavaParamRef<jobject>& jcaller);
32 static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) {
33 return Init(env, JavaParamRef<jobject>(env, jcaller));
36 static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
38 jint nativeChromeBrowserProvider) {
39 ChromeBrowserProvider* native =
40 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
41 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
42 return native->Destroy(env, JavaParamRef<jobject>(env, jcaller));
45 static jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env,
47 jint nativeChromeBrowserProvider,
52 ChromeBrowserProvider* native =
53 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
54 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
55 return native->AddBookmark(env, JavaParamRef<jobject>(env, jcaller),
56 JavaParamRef<jstring>(env, url), JavaParamRef<jstring>(env, title),
60 static ScopedJavaLocalRef<jstring> GetDomainAndRegistry(JNIEnv* env, const
61 JavaParamRef<jclass>& jcaller,
62 const JavaParamRef<jstring>& url);
64 static jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env,
67 return GetDomainAndRegistry(env, JavaParamRef<jclass>(env, jcaller),
68 JavaParamRef<jstring>(env, url)).Release();
71 static void CreateHistoricalTabFromState(JNIEnv* env, const
72 JavaParamRef<jclass>& jcaller,
73 const JavaParamRef<jbyteArray>& state,
76 static void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv*
80 return CreateHistoricalTabFromState(env, JavaParamRef<jclass>(env, jcaller),
81 JavaParamRef<jbyteArray>(env, state), tab_index);
84 static ScopedJavaLocalRef<jbyteArray> GetStateAsByteArray(JNIEnv* env, const
85 JavaParamRef<jobject>& jcaller,
86 const JavaParamRef<jobject>& view);
88 static jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv*
91 return GetStateAsByteArray(env, JavaParamRef<jobject>(env, jcaller),
92 JavaParamRef<jobject>(env, view)).Release();
95 static ScopedJavaLocalRef<jobjectArray> GetAutofillProfileGUIDs(JNIEnv* env,
96 const JavaParamRef<jclass>& jcaller);
99 Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass
101 return GetAutofillProfileGUIDs(env, JavaParamRef<jclass>(env,
105 static void SetRecognitionResults(JNIEnv* env, const JavaParamRef<jobject>&
108 const JavaParamRef<jobjectArray>& results);
110 static void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env,
113 jobjectArray results) {
114 return SetRecognitionResults(env, JavaParamRef<jobject>(env, jcaller),
115 sessionId, JavaParamRef<jobjectArray>(env, results));
118 static jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env,
120 jint nativeChromeBrowserProvider,
128 ChromeBrowserProvider* native =
129 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
130 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
131 return native->AddBookmarkFromAPI(env, JavaParamRef<jobject>(env, jcaller),
132 JavaParamRef<jstring>(env, url), JavaParamRef<jobject>(env, created),
133 JavaParamRef<jobject>(env, isBookmark), JavaParamRef<jobject>(env, date),
134 JavaParamRef<jbyteArray>(env, favicon), JavaParamRef<jstring>(env, title),
135 JavaParamRef<jobject>(env, visits));
138 static jint FindAll(JNIEnv* env, const JavaParamRef<jobject>& jcaller,
139 const JavaParamRef<jstring>& find);
141 static jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject
144 return FindAll(env, JavaParamRef<jobject>(env, jcaller),
145 JavaParamRef<jstring>(env, find));
148 static ScopedJavaLocalRef<jobject> GetInnerClass(JNIEnv* env, const
149 JavaParamRef<jclass>& jcaller);
151 static jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass
153 return GetInnerClass(env, JavaParamRef<jclass>(env, jcaller)).Release();
156 static jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env,
158 jint nativeChromeBrowserProvider,
159 jobjectArray projection,
161 jobjectArray selectionArgs,
163 ChromeBrowserProvider* native =
164 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
165 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
166 return native->QueryBitmap(env, JavaParamRef<jobject>(env, jcaller),
167 JavaParamRef<jobjectArray>(env, projection), JavaParamRef<jstring>(env,
168 selection), JavaParamRef<jobjectArray>(env, selectionArgs),
169 JavaParamRef<jstring>(env, sortOrder)).Release();
172 static void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env,
174 jint nativeDataFetcherImplAndroid,
178 DataFetcherImplAndroid* native =
179 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
180 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
181 return native->GotOrientation(env, JavaParamRef<jobject>(env, jcaller), alpha,
185 static ScopedJavaLocalRef<jthrowable> MessWithJavaException(JNIEnv* env, const
186 JavaParamRef<jclass>& jcaller,
187 const JavaParamRef<jthrowable>& e);
189 static jthrowable Java_org_chromium_TestJni_nativeMessWithJavaException(JNIEnv*
192 return MessWithJavaException(env, JavaParamRef<jclass>(env, jcaller),
193 JavaParamRef<jthrowable>(env, e)).Release();
196 // Step 3: RegisterNatives.
198 static const JNINativeMethod kMethodsTestJni[] = {
202 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
207 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) },
208 { "nativeAddBookmark",
216 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmark) },
217 { "nativeGetDomainAndRegistry",
221 "Ljava/lang/String;",
222 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetDomainAndRegistry)
224 { "nativeCreateHistoricalTabFromState",
230 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState)
232 { "nativeGetStateAsByteArray",
234 "Landroid/view/View;"
237 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetStateAsByteArray)
239 { "nativeGetAutofillProfileGUIDs",
242 "[Ljava/lang/String;",
243 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs)
245 { "nativeSetRecognitionResults",
248 "[Ljava/lang/String;"
251 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeSetRecognitionResults)
253 { "nativeAddBookmarkFromAPI",
258 "Ljava/lang/Boolean;"
262 "Ljava/lang/Integer;"
264 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI)
270 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeFindAll) },
271 { "nativeGetInnerClass",
274 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
275 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetInnerClass) },
276 { "nativeQueryBitmap",
279 "[Ljava/lang/String;"
281 "[Ljava/lang/String;"
284 "Landroid/graphics/Bitmap;",
285 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeQueryBitmap) },
286 { "nativeGotOrientation",
293 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGotOrientation) },
294 { "nativeMessWithJavaException",
296 "Ljava/lang/Throwable;"
298 "Ljava/lang/Throwable;",
299 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeMessWithJavaException)
303 static bool RegisterNativesImpl(JNIEnv* env) {
305 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
306 base::android::GetClass(env, kTestJniClassPath).obj()));
308 const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
310 if (env->RegisterNatives(TestJni_clazz(env),
312 kMethodsTestJniSize) < 0) {
313 jni_generator::HandleRegistrationError(
314 env, TestJni_clazz(env), __FILE__);
321 #endif // org_chromium_TestJni_JNI