LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 15 matching lines...) Expand all Loading... |
26 for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = subscriptions.be
gin(), end = subscriptions.end(); it != end; it++) | 26 for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = subscriptions.be
gin(), end = subscriptions.end(); it != end; it++) |
27 { | 27 { |
28 JniAddObjectToList(env, list, NewJniSubscription(env, *it)); | 28 JniAddObjectToList(env, list, NewJniSubscription(env, *it)); |
29 } | 29 } |
30 | 30 |
31 return list; | 31 return list; |
32 } | 32 } |
33 | 33 |
34 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong enginePtr) | 34 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong enginePtr) |
35 { | 35 { |
36 TRY | 36 try |
37 { | 37 { |
38 AdblockPlus::JsEnginePtr& jsEngine = *JniLongToTypePtr<AdblockPlus::JsEngine
Ptr>(enginePtr); | 38 AdblockPlus::JsEnginePtr& jsEngine = *JniLongToTypePtr<AdblockPlus::JsEngine
Ptr>(enginePtr); |
39 return JniPtrToLong(new AdblockPlus::FilterEngine(jsEngine)); | 39 return JniPtrToLong(new AdblockPlus::FilterEngine(jsEngine)); |
40 } | 40 } |
41 CATCH_THROW_AND_RETURN(env, 0) | 41 CATCH_THROW_AND_RETURN(env, 0) |
42 } | 42 } |
43 | 43 |
44 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) | 44 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
45 { | 45 { |
46 delete JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr); | 46 delete JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr); |
47 } | 47 } |
48 | 48 |
49 static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr) | 49 static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr) |
50 { | 50 { |
51 TRY | 51 try |
52 { | 52 { |
53 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngi
ne>(ptr); | 53 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngi
ne>(ptr); |
54 | 54 |
55 return engine->IsFirstRun() ? JNI_TRUE : JNI_FALSE; | 55 return engine->IsFirstRun() ? JNI_TRUE : JNI_FALSE; |
56 } | 56 } |
57 CATCH_THROW_AND_RETURN(env, JNI_FALSE); | 57 CATCH_THROW_AND_RETURN(env, JNI_FALSE); |
58 } | 58 } |
59 | 59 |
60 static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin
g jText) | 60 static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin
g jText) |
61 { | 61 { |
62 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 62 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
63 std::string text = JniJava2StdString(env, jText); | 63 std::string text = JniJavaToStdString(env, jText); |
64 | 64 |
65 TRY | 65 try |
66 { | 66 { |
67 AdblockPlus::FilterPtr filter = engine->GetFilter(text); | 67 AdblockPlus::FilterPtr filter = engine->GetFilter(text); |
68 | 68 |
69 return NewJniFilter(env, filter); | 69 return NewJniFilter(env, filter); |
70 } | 70 } |
71 CATCH_THROW_AND_RETURN(env, 0); | 71 CATCH_THROW_AND_RETURN(env, 0); |
72 } | 72 } |
73 | 73 |
74 static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr) | 74 static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr) |
75 { | 75 { |
76 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 76 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
77 | 77 |
78 TRY | 78 try |
79 { | 79 { |
80 std::vector<AdblockPlus::FilterPtr> filters = engine->GetListedFilters(); | 80 std::vector<AdblockPlus::FilterPtr> filters = engine->GetListedFilters(); |
81 | 81 |
82 jobject list = NewJniArrayList(env); | 82 jobject list = NewJniArrayList(env); |
83 | 83 |
84 for (std::vector<AdblockPlus::FilterPtr>::iterator it = filters.begin(), end
= filters.end(); it != end; it++) | 84 for (std::vector<AdblockPlus::FilterPtr>::iterator it = filters.begin(), end
= filters.end(); it != end; it++) |
85 { | 85 { |
86 JniAddObjectToList(env, list, NewJniFilter(env, *it)); | 86 JniAddObjectToList(env, list, NewJniFilter(env, *it)); |
87 } | 87 } |
88 | 88 |
89 return list; | 89 return list; |
90 } | 90 } |
91 CATCH_THROW_AND_RETURN(env, 0); | 91 CATCH_THROW_AND_RETURN(env, 0); |
92 } | 92 } |
93 | 93 |
94 static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
jstring jUrl) | 94 static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
jstring jUrl) |
95 { | 95 { |
96 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 96 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
97 std::string url = JniJava2StdString(env, jUrl); | 97 std::string url = JniJavaToStdString(env, jUrl); |
98 | 98 |
99 TRY | 99 try |
100 { | 100 { |
101 AdblockPlus::SubscriptionPtr subscription = engine->GetSubscription(url); | 101 AdblockPlus::SubscriptionPtr subscription = engine->GetSubscription(url); |
102 | 102 |
103 return NewJniSubscription(env, subscription); | 103 return NewJniSubscription(env, subscription); |
104 } | 104 } |
105 CATCH_THROW_AND_RETURN(env, 0); | 105 CATCH_THROW_AND_RETURN(env, 0); |
106 } | 106 } |
107 | 107 |
108 static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon
g ptr) | 108 static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon
g ptr) |
109 { | 109 { |
110 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 110 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
111 | 111 |
112 TRY | 112 try |
113 { | 113 { |
114 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->GetListedS
ubscriptions(); | 114 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->GetListedS
ubscriptions(); |
115 | 115 |
116 return SubscriptionsToArrayList(env, subscriptions); | 116 return SubscriptionsToArrayList(env, subscriptions); |
117 } | 117 } |
118 CATCH_THROW_AND_RETURN(env, 0); | 118 CATCH_THROW_AND_RETURN(env, 0); |
119 } | 119 } |
120 | 120 |
121 static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz,
jlong ptr) | 121 static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz,
jlong ptr) |
122 { | 122 { |
123 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 123 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
124 | 124 |
125 TRY | 125 try |
126 { | 126 { |
127 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvail
ableSubscriptions(); | 127 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvail
ableSubscriptions(); |
128 | 128 |
129 return SubscriptionsToArrayList(env, subscriptions); | 129 return SubscriptionsToArrayList(env, subscriptions); |
130 } | 130 } |
131 CATCH_THROW_AND_RETURN(env, 0); | 131 CATCH_THROW_AND_RETURN(env, 0); |
132 } | 132 } |
133 | 133 |
134 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo
ng ptr) | 134 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo
ng ptr) |
135 { | 135 { |
136 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 136 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
137 | 137 |
138 TRY | 138 try |
139 { | 139 { |
140 engine->RemoveFilterChangeCallback(); | 140 engine->RemoveFilterChangeCallback(); |
141 } | 141 } |
142 CATCH_AND_THROW(env) | 142 CATCH_AND_THROW(env) |
143 } | 143 } |
144 | 144 |
145 static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz, jlong
ptr, jlong filterPtr) | 145 static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz, jlong
ptr, jlong filterPtr) |
146 { | 146 { |
147 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 147 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
148 JniFilterChangeCallback* callback = JniLongToTypePtr<JniFilterChangeCallback>(
filterPtr); | 148 JniFilterChangeCallback* callback = JniLongToTypePtr<JniFilterChangeCallback>(
filterPtr); |
149 | 149 |
150 AdblockPlus::FilterEngine::FilterChangeCallback filterCallback = | 150 AdblockPlus::FilterEngine::FilterChangeCallback filterCallback = |
151 std::tr1::bind(&JniFilterChangeCallback::Callback, callback, std::tr1::pla
ceholders::_1, std::tr1::placeholders::_2); | 151 std::tr1::bind(&JniFilterChangeCallback::Callback, callback, std::tr1::pla
ceholders::_1, std::tr1::placeholders::_2); |
152 | 152 |
153 TRY | 153 try |
154 { | 154 { |
155 engine->SetFilterChangeCallback(filterCallback); | 155 engine->SetFilterChangeCallback(filterCallback); |
156 } | 156 } |
157 CATCH_AND_THROW(env) | 157 CATCH_AND_THROW(env) |
158 } | 158 } |
159 | 159 |
160 static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jl
ong updaterPtr) | 160 static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jl
ong updaterPtr) |
161 { | 161 { |
162 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 162 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
163 JniUpdaterCallback* callback = JniLongToTypePtr<JniUpdaterCallback>(updaterPtr
); | 163 JniUpdaterCallback* callback = JniLongToTypePtr<JniUpdaterCallback>(updaterPtr
); |
164 | 164 |
165 AdblockPlus::FilterEngine::UpdaterCallback updaterCallback = 0; | 165 AdblockPlus::FilterEngine::UpdaterCallback updaterCallback = 0; |
166 | 166 |
167 if (updaterPtr) | 167 if (updaterPtr) |
168 { | 168 { |
169 updaterCallback = std::tr1::bind(&JniUpdaterCallback::Callback, callback, st
d::tr1::placeholders::_1); | 169 updaterCallback = std::tr1::bind(&JniUpdaterCallback::Callback, callback, st
d::tr1::placeholders::_1); |
170 } | 170 } |
171 | 171 |
172 TRY | 172 try |
173 { | 173 { |
174 engine->ForceUpdateCheck(updaterCallback); | 174 engine->ForceUpdateCheck(updaterCallback); |
175 } | 175 } |
176 CATCH_AND_THROW(env) | 176 CATCH_AND_THROW(env) |
177 } | 177 } |
178 | 178 |
179 static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz, j
long ptr, jstring jDomain) | 179 static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz, j
long ptr, jstring jDomain) |
180 { | 180 { |
181 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 181 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
182 | 182 |
183 std::string domain = JniJava2StdString(env, jDomain); | 183 std::string domain = JniJavaToStdString(env, jDomain); |
184 | 184 |
185 TRY | 185 try |
186 { | 186 { |
187 std::vector<std::string> selectors = engine->GetElementHidingSelectors(domai
n); | 187 std::vector<std::string> selectors = engine->GetElementHidingSelectors(domai
n); |
188 | 188 |
189 jobject list = NewJniArrayList(env); | 189 jobject list = NewJniArrayList(env); |
190 | 190 |
191 for (std::vector<std::string>::iterator it = selectors.begin(), end = select
ors.end(); it != end; it++) | 191 for (std::vector<std::string>::iterator it = selectors.begin(), end = select
ors.end(); it != end; it++) |
192 { | 192 { |
193 JniAddObjectToList(env, list, env->NewStringUTF(it->c_str())); | 193 JniAddObjectToList(env, list, env->NewStringUTF(it->c_str())); |
194 } | 194 } |
195 | 195 |
196 return list; | 196 return list; |
197 } | 197 } |
198 CATCH_THROW_AND_RETURN(env, 0) | 198 CATCH_THROW_AND_RETURN(env, 0) |
199 } | 199 } |
200 | 200 |
201 static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring
jUrl, jstring jContentType, jstring jDocumentUrl) | 201 static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring
jUrl, jstring jContentType, jstring jDocumentUrl) |
202 { | 202 { |
203 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 203 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
204 | 204 |
205 std::string url = JniJava2StdString(env, jUrl); | 205 std::string url = JniJavaToStdString(env, jUrl); |
206 std::string contentType = JniJava2StdString(env, jContentType); | 206 std::string contentType = JniJavaToStdString(env, jContentType); |
207 std::string documentUrl = JniJava2StdString(env, jDocumentUrl); | 207 std::string documentUrl = JniJavaToStdString(env, jDocumentUrl); |
208 | 208 |
209 TRY | 209 try |
210 { | 210 { |
211 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr
l); | 211 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr
l); |
212 | 212 |
213 return NewJniFilter(env, filter); | 213 return NewJniFilter(env, filter); |
214 } | 214 } |
215 CATCH_THROW_AND_RETURN(env, 0) | 215 CATCH_THROW_AND_RETURN(env, 0) |
216 } | 216 } |
217 | 217 |
218 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, jstr
ing jUrl, jstring jContentType, jobjectArray jDocumentUrls) | 218 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, jstr
ing jUrl, jstring jContentType, jobjectArray jDocumentUrls) |
219 { | 219 { |
220 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); | 220 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
221 | 221 |
222 std::string url = JniJava2StdString(env, jUrl); | 222 std::string url = JniJavaToStdString(env, jUrl); |
223 std::string contentType = JniJava2StdString(env, jContentType); | 223 std::string contentType = JniJavaToStdString(env, jContentType); |
224 | 224 |
225 std::vector<std::string> documentUrls; | 225 std::vector<std::string> documentUrls; |
226 | 226 |
227 jsize len = env->GetArrayLength(jDocumentUrls); | 227 jsize len = env->GetArrayLength(jDocumentUrls); |
228 | 228 |
229 for (jsize i = 0; i < len; i++) | 229 for (jsize i = 0; i < len; i++) |
230 { | 230 { |
231 documentUrls.push_back(JniJava2StdString(env, static_cast<jstring>(env->GetO
bjectArrayElement(jDocumentUrls, i)))); | 231 documentUrls.push_back(JniJavaToStdString(env, static_cast<jstring>(env->Get
ObjectArrayElement(jDocumentUrls, i)))); |
232 } | 232 } |
233 | 233 |
234 TRY | 234 try |
235 { | 235 { |
236 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr
ls); | 236 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr
ls); |
237 | 237 |
238 return NewJniFilter(env, filter); | 238 return NewJniFilter(env, filter); |
239 } | 239 } |
240 CATCH_THROW_AND_RETURN(env, 0) | 240 CATCH_THROW_AND_RETURN(env, 0) |
241 } | 241 } |
242 | 242 |
243 static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring
jPref) | 243 static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring
jPref) |
244 { | 244 { |
245 AdblockPlus::FilterEngine* engine = JniLongToTypePtr < AdblockPlus::FilterEngi
ne > (ptr); | 245 AdblockPlus::FilterEngine* engine = JniLongToTypePtr < AdblockPlus::FilterEngi
ne > (ptr); |
246 | 246 |
247 std::string pref = JniJava2StdString(env, jPref); | 247 std::string pref = JniJavaToStdString(env, jPref); |
248 | 248 |
249 TRY | 249 try |
250 { | 250 { |
251 AdblockPlus::JsValuePtr value = engine->GetPref(pref); | 251 AdblockPlus::JsValuePtr value = engine->GetPref(pref); |
252 | 252 |
253 return NewJniJsValue(env, value); | 253 return NewJniJsValue(env, value); |
254 } | 254 } |
255 CATCH_THROW_AND_RETURN(env, 0) | 255 CATCH_THROW_AND_RETURN(env, 0) |
256 } | 256 } |
257 | 257 |
258 static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr
ef, jlong jsValue) | 258 static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr
ef, jlong jsValue) |
259 { | 259 { |
260 AdblockPlus::FilterEngine* engine = JniLongToTypePtr < AdblockPlus::FilterEngi
ne > (ptr); | 260 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
>(ptr); |
261 | 261 |
262 std::string pref = JniJava2StdString(env, jPref); | 262 std::string pref = JniJavaToStdString(env, jPref); |
263 AdblockPlus::JsValuePtr value = JniGetJsValuePtr(jsValue); | 263 AdblockPlus::JsValuePtr value = JniGetJsValuePtr(jsValue); |
264 | 264 |
265 TRY | 265 try |
266 { | 266 { |
267 engine->SetPref(pref, value); | 267 engine->SetPref(pref, value); |
268 } | 268 } |
269 CATCH_AND_THROW(env) | 269 CATCH_AND_THROW(env) |
270 } | 270 } |
271 | 271 |
272 static JNINativeMethod methods[] = | 272 static JNINativeMethod methods[] = |
273 { | 273 { |
274 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, | 274 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, |
275 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, | 275 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, |
276 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
GetFilter }, | 276 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
GetFilter }, |
277 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
Filters }, | 277 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
Filters }, |
278 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
, (void*)JniGetSubscription }, | 278 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
, (void*)JniGetSubscription }, |
279 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
ListedSubscriptions }, | 279 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
ListedSubscriptions }, |
280 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
niFetchAvailableSubscriptions }, | 280 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
niFetchAvailableSubscriptions }, |
281 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
allback }, | 281 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
allback }, |
282 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
angeCallback }, | 282 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
angeCallback }, |
283 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, | 283 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, |
284 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
List;", (void*)JniGetElementHidingSelectors }, | 284 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
List;", (void*)JniGetElementHidingSelectors }, |
285 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/S
tring;)" TYP("Filter"), (void*)JniMatches }, | 285 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/S
tring;)" TYP("Filter"), (void*)JniMatches }, |
286 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;[Ljava/lang/
String;)" TYP("Filter"), (void*)JniMatchesMany }, | 286 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;[Ljava/lang/
String;)" TYP("Filter"), (void*)JniMatchesMany }, |
287 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
etPref }, | 287 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
etPref }, |
288 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, | 288 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, |
289 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 289 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
290 }; | 290 }; |
291 | 291 |
292 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_FilterEngine_
registerNatives(JNIEnv *env, jclass clazz) | 292 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
ne_registerNatives(JNIEnv *env, jclass clazz) |
293 { | 293 { |
294 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 294 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
295 } | 295 } |
LEFT | RIGHT |