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 static jint Init(JNIEnv* env, jobject jcaller);
30 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller,
33 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller,
37 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller,
40 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller);
42 static void SetRecognitionResults(JNIEnv* env, jobject jcaller,
44 jobjectArray results);
46 static jint FindAll(JNIEnv* env, jobject jcaller,
49 static jobject GetInnerClass(JNIEnv* env, jclass jcaller);
51 // Step 2: method stubs.
52 static void Destroy(JNIEnv* env, jobject jcaller,
53 jint nativeChromeBrowserProvider) {
54 ChromeBrowserProvider* native =
55 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
56 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
57 return native->Destroy(env, jcaller);
60 static jlong AddBookmark(JNIEnv* env, jobject jcaller,
61 jint nativeChromeBrowserProvider,
66 ChromeBrowserProvider* native =
67 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
68 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
69 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId);
72 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller,
73 jint nativeChromeBrowserProvider,
81 ChromeBrowserProvider* native =
82 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
83 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
84 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark,
85 date, favicon, title, visits);
88 static jobject QueryBitmap(JNIEnv* env, jobject jcaller,
89 jint nativeChromeBrowserProvider,
90 jobjectArray projection,
92 jobjectArray selectionArgs,
94 ChromeBrowserProvider* native =
95 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
96 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
97 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs,
101 static void GotOrientation(JNIEnv* env, jobject jcaller,
102 jint nativeDataFetcherImplAndroid,
106 DataFetcherImplAndroid* native =
107 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
108 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
109 return native->GotOrientation(env, jcaller, alpha, beta, gamma);
112 // Step 3: RegisterNatives.
114 static const JNINativeMethod kMethodsTestJni[] = {
118 "I", reinterpret_cast<void*>(Init) },
123 "V", reinterpret_cast<void*>(Destroy) },
124 { "nativeAddBookmark",
132 "J", reinterpret_cast<void*>(AddBookmark) },
133 { "nativeGetDomainAndRegistry",
137 "Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) },
138 { "nativeCreateHistoricalTabFromState",
143 "V", reinterpret_cast<void*>(CreateHistoricalTabFromState) },
144 { "nativeGetStateAsByteArray",
146 "Landroid/view/View;"
148 "[B", reinterpret_cast<void*>(GetStateAsByteArray) },
149 { "nativeGetAutofillProfileGUIDs",
152 "[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) },
153 { "nativeSetRecognitionResults",
156 "[Ljava/lang/String;"
158 "V", reinterpret_cast<void*>(SetRecognitionResults) },
159 { "nativeAddBookmarkFromAPI",
164 "Ljava/lang/Boolean;"
168 "Ljava/lang/Integer;"
170 "J", reinterpret_cast<void*>(AddBookmarkFromAPI) },
175 "I", reinterpret_cast<void*>(FindAll) },
176 { "nativeGetInnerClass",
179 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
180 reinterpret_cast<void*>(GetInnerClass) },
181 { "nativeQueryBitmap",
184 "[Ljava/lang/String;"
186 "[Ljava/lang/String;"
189 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) },
190 { "nativeGotOrientation",
197 "V", reinterpret_cast<void*>(GotOrientation) },
200 static bool RegisterNativesImpl(JNIEnv* env) {
202 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
203 base::android::GetClass(env, kTestJniClassPath).obj()));
205 const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
207 if (env->RegisterNatives(TestJni_clazz(env),
209 kMethodsTestJniSize) < 0) {
210 jni_generator::HandleRegistrationError(
211 env, TestJni_clazz(env), __FILE__);
218 #endif // org_chromium_TestJni_JNI