OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is autogenerated by | 5 // This file is autogenerated by |
6 // base/android/jni_generator/jni_generator.py | 6 // base/android/jni_generator/jni_generator.py |
7 // For | 7 // For |
8 // org/chromium/TestJni | 8 // org/chromium/TestJni |
9 | 9 |
10 #ifndef org_chromium_TestJni_JNI | 10 #ifndef org_chromium_TestJni_JNI |
11 #define org_chromium_TestJni_JNI | 11 #define org_chromium_TestJni_JNI |
12 | 12 |
13 #include <jni.h> | 13 #include <jni.h> |
14 | 14 |
15 #include "base/android/jni_generator/jni_generator_helper.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
16 | 16 |
17 #include "base/android/jni_int_wrapper.h" | 17 #include "base/android/jni_int_wrapper.h" |
18 | 18 |
19 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
20 namespace { | 20 namespace { |
21 const char kTestJniClassPath[] = "org/chromium/TestJni"; | 21 const char kTestJniClassPath[] = "org/chromium/TestJni"; |
22 // Leaking this jclass as we cannot use LazyInstance from some threads. | 22 // Leaking this jclass as we cannot use LazyInstance from some threads. |
23 jclass g_TestJni_clazz = NULL; | 23 jclass g_TestJni_clazz = NULL; |
24 #define TestJni_clazz(env) g_TestJni_clazz | 24 #define TestJni_clazz(env) g_TestJni_clazz |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
| 28 // Step 2: method stubs. |
| 29 |
28 static jint Init(JNIEnv* env, jobject jcaller); | 30 static jint Init(JNIEnv* env, jobject jcaller); |
29 | 31 |
30 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller, | 32 static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) { |
31 jstring url); | 33 return Init(env, jcaller); |
| 34 } |
32 | 35 |
33 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller, | 36 static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env, |
34 jbyteArray state, | 37 jobject jcaller, |
35 jint tab_index); | |
36 | |
37 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller, | |
38 jobject view); | |
39 | |
40 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller); | |
41 | |
42 static void SetRecognitionResults(JNIEnv* env, jobject jcaller, | |
43 jint sessionId, | |
44 jobjectArray results); | |
45 | |
46 static jint FindAll(JNIEnv* env, jobject jcaller, | |
47 jstring find); | |
48 | |
49 static jobject GetInnerClass(JNIEnv* env, jclass jcaller); | |
50 | |
51 // Step 2: method stubs. | |
52 static void Destroy(JNIEnv* env, jobject jcaller, | |
53 jint nativeChromeBrowserProvider) { | 38 jint nativeChromeBrowserProvider) { |
54 ChromeBrowserProvider* native = | 39 ChromeBrowserProvider* native = |
55 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 40 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); |
56 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); | 41 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); |
57 return native->Destroy(env, jcaller); | 42 return native->Destroy(env, jcaller); |
58 } | 43 } |
59 | 44 |
60 static jlong AddBookmark(JNIEnv* env, jobject jcaller, | 45 static jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env, |
| 46 jobject jcaller, |
61 jint nativeChromeBrowserProvider, | 47 jint nativeChromeBrowserProvider, |
62 jstring url, | 48 jstring url, |
63 jstring title, | 49 jstring title, |
64 jboolean isFolder, | 50 jboolean isFolder, |
65 jlong parentId) { | 51 jlong parentId) { |
66 ChromeBrowserProvider* native = | 52 ChromeBrowserProvider* native = |
67 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 53 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); |
68 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); | 54 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); |
69 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId); | 55 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId); |
70 } | 56 } |
71 | 57 |
72 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller, | 58 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller, |
| 59 jstring url); |
| 60 |
| 61 static jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env, |
| 62 jclass jcaller, |
| 63 jstring url) { |
| 64 return GetDomainAndRegistry(env, jcaller, url); |
| 65 } |
| 66 |
| 67 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller, |
| 68 jbyteArray state, |
| 69 jint tab_index); |
| 70 |
| 71 static void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv* |
| 72 env, jclass jcaller, |
| 73 jbyteArray state, |
| 74 jint tab_index) { |
| 75 return CreateHistoricalTabFromState(env, jcaller, state, tab_index); |
| 76 } |
| 77 |
| 78 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller, |
| 79 jobject view); |
| 80 |
| 81 static jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv* |
| 82 env, jobject jcaller, |
| 83 jobject view) { |
| 84 return GetStateAsByteArray(env, jcaller, view); |
| 85 } |
| 86 |
| 87 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller); |
| 88 |
| 89 static jobjectArray |
| 90 Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass |
| 91 jcaller) { |
| 92 return GetAutofillProfileGUIDs(env, jcaller); |
| 93 } |
| 94 |
| 95 static void SetRecognitionResults(JNIEnv* env, jobject jcaller, |
| 96 jint sessionId, |
| 97 jobjectArray results); |
| 98 |
| 99 static void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env, |
| 100 jobject jcaller, |
| 101 jint sessionId, |
| 102 jobjectArray results) { |
| 103 return SetRecognitionResults(env, jcaller, sessionId, results); |
| 104 } |
| 105 |
| 106 static jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env, |
| 107 jobject jcaller, |
73 jint nativeChromeBrowserProvider, | 108 jint nativeChromeBrowserProvider, |
74 jstring url, | 109 jstring url, |
75 jobject created, | 110 jobject created, |
76 jobject isBookmark, | 111 jobject isBookmark, |
77 jobject date, | 112 jobject date, |
78 jbyteArray favicon, | 113 jbyteArray favicon, |
79 jstring title, | 114 jstring title, |
80 jobject visits) { | 115 jobject visits) { |
81 ChromeBrowserProvider* native = | 116 ChromeBrowserProvider* native = |
82 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 117 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); |
83 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); | 118 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); |
84 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark, | 119 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark, |
85 date, favicon, title, visits); | 120 date, favicon, title, visits); |
86 } | 121 } |
87 | 122 |
88 static jobject QueryBitmap(JNIEnv* env, jobject jcaller, | 123 static jint FindAll(JNIEnv* env, jobject jcaller, |
| 124 jstring find); |
| 125 |
| 126 static jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject |
| 127 jcaller, |
| 128 jstring find) { |
| 129 return FindAll(env, jcaller, find); |
| 130 } |
| 131 |
| 132 static jobject GetInnerClass(JNIEnv* env, jclass jcaller); |
| 133 |
| 134 static jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass |
| 135 jcaller) { |
| 136 return GetInnerClass(env, jcaller); |
| 137 } |
| 138 |
| 139 static jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env, |
| 140 jobject jcaller, |
89 jint nativeChromeBrowserProvider, | 141 jint nativeChromeBrowserProvider, |
90 jobjectArray projection, | 142 jobjectArray projection, |
91 jstring selection, | 143 jstring selection, |
92 jobjectArray selectionArgs, | 144 jobjectArray selectionArgs, |
93 jstring sortOrder) { | 145 jstring sortOrder) { |
94 ChromeBrowserProvider* native = | 146 ChromeBrowserProvider* native = |
95 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); | 147 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); |
96 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); | 148 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); |
97 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs, | 149 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs, |
98 sortOrder).Release(); | 150 sortOrder).Release(); |
99 } | 151 } |
100 | 152 |
101 static void GotOrientation(JNIEnv* env, jobject jcaller, | 153 static void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env, |
| 154 jobject jcaller, |
102 jint nativeDataFetcherImplAndroid, | 155 jint nativeDataFetcherImplAndroid, |
103 jdouble alpha, | 156 jdouble alpha, |
104 jdouble beta, | 157 jdouble beta, |
105 jdouble gamma) { | 158 jdouble gamma) { |
106 DataFetcherImplAndroid* native = | 159 DataFetcherImplAndroid* native = |
107 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); | 160 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); |
108 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); | 161 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); |
109 return native->GotOrientation(env, jcaller, alpha, beta, gamma); | 162 return native->GotOrientation(env, jcaller, alpha, beta, gamma); |
110 } | 163 } |
111 | 164 |
112 // Step 3: RegisterNatives. | 165 // Step 3: RegisterNatives. |
113 | 166 |
114 static const JNINativeMethod kMethodsTestJni[] = { | 167 static const JNINativeMethod kMethodsTestJni[] = { |
115 { "nativeInit", | 168 { "nativeInit", |
116 "(" | 169 "(" |
117 ")" | 170 ")" |
118 "I", reinterpret_cast<void*>(Init) }, | 171 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) }, |
119 { "nativeDestroy", | 172 { "nativeDestroy", |
120 "(" | 173 "(" |
121 "I" | 174 "I" |
122 ")" | 175 ")" |
123 "V", reinterpret_cast<void*>(Destroy) }, | 176 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) }, |
124 { "nativeAddBookmark", | 177 { "nativeAddBookmark", |
125 "(" | 178 "(" |
126 "I" | 179 "I" |
127 "Ljava/lang/String;" | 180 "Ljava/lang/String;" |
128 "Ljava/lang/String;" | 181 "Ljava/lang/String;" |
129 "Z" | 182 "Z" |
130 "J" | 183 "J" |
131 ")" | 184 ")" |
132 "J", reinterpret_cast<void*>(AddBookmark) }, | 185 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmark) }, |
133 { "nativeGetDomainAndRegistry", | 186 { "nativeGetDomainAndRegistry", |
134 "(" | 187 "(" |
135 "Ljava/lang/String;" | 188 "Ljava/lang/String;" |
136 ")" | 189 ")" |
137 "Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) }, | 190 "Ljava/lang/String;", |
| 191 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetDomainAndRegistry
) |
| 192 }, |
138 { "nativeCreateHistoricalTabFromState", | 193 { "nativeCreateHistoricalTabFromState", |
139 "(" | 194 "(" |
140 "[B" | 195 "[B" |
141 "I" | 196 "I" |
142 ")" | 197 ")" |
143 "V", reinterpret_cast<void*>(CreateHistoricalTabFromState) }, | 198 "V", |
| 199 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeCreateHistoricalTabF
romState) |
| 200 }, |
144 { "nativeGetStateAsByteArray", | 201 { "nativeGetStateAsByteArray", |
145 "(" | 202 "(" |
146 "Landroid/view/View;" | 203 "Landroid/view/View;" |
147 ")" | 204 ")" |
148 "[B", reinterpret_cast<void*>(GetStateAsByteArray) }, | 205 "[B", |
| 206 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetStateAsByteArray) |
| 207 }, |
149 { "nativeGetAutofillProfileGUIDs", | 208 { "nativeGetAutofillProfileGUIDs", |
150 "(" | 209 "(" |
151 ")" | 210 ")" |
152 "[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) }, | 211 "[Ljava/lang/String;", |
| 212 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetAutofillProfileGU
IDs) |
| 213 }, |
153 { "nativeSetRecognitionResults", | 214 { "nativeSetRecognitionResults", |
154 "(" | 215 "(" |
155 "I" | 216 "I" |
156 "[Ljava/lang/String;" | 217 "[Ljava/lang/String;" |
157 ")" | 218 ")" |
158 "V", reinterpret_cast<void*>(SetRecognitionResults) }, | 219 "V", |
| 220 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeSetRecognitionResult
s) |
| 221 }, |
159 { "nativeAddBookmarkFromAPI", | 222 { "nativeAddBookmarkFromAPI", |
160 "(" | 223 "(" |
161 "I" | 224 "I" |
162 "Ljava/lang/String;" | 225 "Ljava/lang/String;" |
163 "Ljava/lang/Long;" | 226 "Ljava/lang/Long;" |
164 "Ljava/lang/Boolean;" | 227 "Ljava/lang/Boolean;" |
165 "Ljava/lang/Long;" | 228 "Ljava/lang/Long;" |
166 "[B" | 229 "[B" |
167 "Ljava/lang/String;" | 230 "Ljava/lang/String;" |
168 "Ljava/lang/Integer;" | 231 "Ljava/lang/Integer;" |
169 ")" | 232 ")" |
170 "J", reinterpret_cast<void*>(AddBookmarkFromAPI) }, | 233 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI) |
| 234 }, |
171 { "nativeFindAll", | 235 { "nativeFindAll", |
172 "(" | 236 "(" |
173 "Ljava/lang/String;" | 237 "Ljava/lang/String;" |
174 ")" | 238 ")" |
175 "I", reinterpret_cast<void*>(FindAll) }, | 239 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeFindAll) }, |
176 { "nativeGetInnerClass", | 240 { "nativeGetInnerClass", |
177 "(" | 241 "(" |
178 ")" | 242 ")" |
179 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;", | 243 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;", |
180 reinterpret_cast<void*>(GetInnerClass) }, | 244 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetInnerClass) }, |
181 { "nativeQueryBitmap", | 245 { "nativeQueryBitmap", |
182 "(" | 246 "(" |
183 "I" | 247 "I" |
184 "[Ljava/lang/String;" | 248 "[Ljava/lang/String;" |
185 "Ljava/lang/String;" | 249 "Ljava/lang/String;" |
186 "[Ljava/lang/String;" | 250 "[Ljava/lang/String;" |
187 "Ljava/lang/String;" | 251 "Ljava/lang/String;" |
188 ")" | 252 ")" |
189 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) }, | 253 "Landroid/graphics/Bitmap;", |
| 254 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeQueryBitmap) }, |
190 { "nativeGotOrientation", | 255 { "nativeGotOrientation", |
191 "(" | 256 "(" |
192 "I" | 257 "I" |
193 "D" | 258 "D" |
194 "D" | 259 "D" |
195 "D" | 260 "D" |
196 ")" | 261 ")" |
197 "V", reinterpret_cast<void*>(GotOrientation) }, | 262 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGotOrientation) }, |
198 }; | 263 }; |
199 | 264 |
200 static bool RegisterNativesImpl(JNIEnv* env) { | 265 static bool RegisterNativesImpl(JNIEnv* env) { |
201 | 266 |
202 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 267 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
203 base::android::GetClass(env, kTestJniClassPath).obj())); | 268 base::android::GetClass(env, kTestJniClassPath).obj())); |
204 | 269 |
205 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); | 270 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); |
206 | 271 |
207 if (env->RegisterNatives(TestJni_clazz(env), | 272 if (env->RegisterNatives(TestJni_clazz(env), |
208 kMethodsTestJni, | 273 kMethodsTestJni, |
209 kMethodsTestJniSize) < 0) { | 274 kMethodsTestJniSize) < 0) { |
210 jni_generator::HandleRegistrationError( | 275 jni_generator::HandleRegistrationError( |
211 env, TestJni_clazz(env), __FILE__); | 276 env, TestJni_clazz(env), __FILE__); |
212 return false; | 277 return false; |
213 } | 278 } |
214 | 279 |
215 return true; | 280 return true; |
216 } | 281 } |
217 | 282 |
218 #endif // org_chromium_TestJni_JNI | 283 #endif // org_chromium_TestJni_JNI |
OLD | NEW |