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.
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;
27 static jint Init(JNIEnv* env, jobject jcaller);
29 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller,
32 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller,
36 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller,
39 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller);
41 static void SetRecognitionResults(JNIEnv* env, jobject jcaller,
43 jobjectArray results);
45 static jint FindAll(JNIEnv* env, jobject jcaller,
48 static jobject GetInnerClass(JNIEnv* env, jclass jcaller);
50 // Step 2: method stubs.
51 static void Destroy(JNIEnv* env, jobject jcaller,
52 jint nativeChromeBrowserProvider) {
53 ChromeBrowserProvider* native =
54 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
55 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
56 return native->Destroy(env, jcaller);
59 static jlong AddBookmark(JNIEnv* env, jobject jcaller,
60 jint nativeChromeBrowserProvider,
65 ChromeBrowserProvider* native =
66 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
67 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
68 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId);
71 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller,
72 jint nativeChromeBrowserProvider,
80 ChromeBrowserProvider* native =
81 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
82 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
83 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark,
84 date, favicon, title, visits);
87 static jobject QueryBitmap(JNIEnv* env, jobject jcaller,
88 jint nativeChromeBrowserProvider,
89 jobjectArray projection,
91 jobjectArray selectionArgs,
93 ChromeBrowserProvider* native =
94 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
95 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
96 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs,
100 static void GotOrientation(JNIEnv* env, jobject jcaller,
101 jint nativeDataFetcherImplAndroid,
105 DataFetcherImplAndroid* native =
106 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
107 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
108 return native->GotOrientation(env, jcaller, alpha, beta, gamma);
111 // Step 3: RegisterNatives.
113 static const JNINativeMethod kMethodsTestJni[] = {
117 "I", reinterpret_cast<void*>(Init) },
122 "V", reinterpret_cast<void*>(Destroy) },
123 { "nativeAddBookmark",
131 "J", reinterpret_cast<void*>(AddBookmark) },
132 { "nativeGetDomainAndRegistry",
136 "Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) },
137 { "nativeCreateHistoricalTabFromState",
142 "V", reinterpret_cast<void*>(CreateHistoricalTabFromState) },
143 { "nativeGetStateAsByteArray",
145 "Landroid/view/View;"
147 "[B", reinterpret_cast<void*>(GetStateAsByteArray) },
148 { "nativeGetAutofillProfileGUIDs",
151 "[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) },
152 { "nativeSetRecognitionResults",
155 "[Ljava/lang/String;"
157 "V", reinterpret_cast<void*>(SetRecognitionResults) },
158 { "nativeAddBookmarkFromAPI",
163 "Ljava/lang/Boolean;"
167 "Ljava/lang/Integer;"
169 "J", reinterpret_cast<void*>(AddBookmarkFromAPI) },
174 "I", reinterpret_cast<void*>(FindAll) },
175 { "nativeGetInnerClass",
178 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
179 reinterpret_cast<void*>(GetInnerClass) },
180 { "nativeQueryBitmap",
183 "[Ljava/lang/String;"
185 "[Ljava/lang/String;"
188 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) },
189 { "nativeGotOrientation",
196 "V", reinterpret_cast<void*>(GotOrientation) },
199 static bool RegisterNativesImpl(JNIEnv* env) {
200 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
201 base::android::GetClass(env, kTestJniClassPath).obj()));
203 const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
205 if (env->RegisterNatives(g_TestJni_clazz,
207 kMethodsTestJniSize) < 0) {
208 jni_generator::HandleRegistrationError(
209 env, g_TestJni_clazz, __FILE__);
216 #endif // org_chromium_TestJni_JNI