| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-present eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 #include <AdblockPlus.h> | |
| 19 #include "Utils.h" | |
| 20 #include "JniCallbacks.h" | |
| 21 #include <thread> | |
| 22 #include "JniPlatform.h" | |
| 23 | |
| 24 static jobject SubscriptionsToArrayList(JNIEnv* env, std::vector<AdblockPlus::Su
bscription>&& subscriptions) | |
| 25 { | |
| 26 jobject list = NewJniArrayList(env); | |
| 27 | |
| 28 for (std::vector<AdblockPlus::Subscription>::iterator it = subscriptions.begin
(), end = subscriptions.end(); it != end; it++) | |
| 29 { | |
| 30 JniAddObjectToList(env, list, NewJniSubscription(env, std::move(*it))); | |
| 31 } | |
| 32 | |
| 33 return list; | |
| 34 } | |
| 35 | |
| 36 static AdblockPlus::FilterEngine::ContentType ConvertContentType(JNIEnv *env, | |
| 37 jobject jContentType) | |
| 38 { | |
| 39 JniLocalReference<jclass> contentTypeClass(env, | |
| 40 env->GetObjectClass(jContentType)); | |
| 41 jmethodID nameMethod = env->GetMethodID(*contentTypeClass, "name", | |
| 42 "()Ljava/lang/String;"); | |
| 43 JniLocalReference<jstring> jValue(env, | |
| 44 (jstring) env->CallObjectMethod(jContentType, nameMethod)); | |
| 45 const std::string value = JniJavaToStdString(env, *jValue); | |
| 46 return AdblockPlus::FilterEngine::StringToContentType(value); | |
| 47 } | |
| 48 | |
| 49 namespace | |
| 50 { | |
| 51 AdblockPlus::FilterEngine& GetFilterEngineRef(jlong jniPlatformPtr) | |
| 52 { | |
| 53 return JniLongToTypePtr<JniPlatform>(jniPlatformPtr)->platform->GetFilterEng
ine(); | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr) | |
| 58 { | |
| 59 try | |
| 60 { | |
| 61 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 62 | |
| 63 return engine.IsFirstRun() ? JNI_TRUE : JNI_FALSE; | |
| 64 } | |
| 65 CATCH_THROW_AND_RETURN(env, JNI_FALSE); | |
| 66 } | |
| 67 | |
| 68 static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin
g jText) | |
| 69 { | |
| 70 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 71 std::string text = JniJavaToStdString(env, jText); | |
| 72 | |
| 73 try | |
| 74 { | |
| 75 return NewJniFilter(env, engine.GetFilter(text)); | |
| 76 } | |
| 77 CATCH_THROW_AND_RETURN(env, 0); | |
| 78 } | |
| 79 | |
| 80 static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr) | |
| 81 { | |
| 82 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 83 | |
| 84 try | |
| 85 { | |
| 86 std::vector<AdblockPlus::Filter> filters = engine.GetListedFilters(); | |
| 87 | |
| 88 jobject list = NewJniArrayList(env); | |
| 89 | |
| 90 for (std::vector<AdblockPlus::Filter>::iterator it = filters.begin(), end =
filters.end(); it != end; it++) | |
| 91 { | |
| 92 JniAddObjectToList(env, list, *JniLocalReference<jobject>(env, NewJniFilte
r(env, std::move(*it)))); | |
| 93 } | |
| 94 | |
| 95 return list; | |
| 96 } | |
| 97 CATCH_THROW_AND_RETURN(env, 0); | |
| 98 } | |
| 99 | |
| 100 static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
jstring jUrl) | |
| 101 { | |
| 102 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 103 std::string url = JniJavaToStdString(env, jUrl); | |
| 104 | |
| 105 try | |
| 106 { | |
| 107 return NewJniSubscription(env, engine.GetSubscription(url)); | |
| 108 } | |
| 109 CATCH_THROW_AND_RETURN(env, 0); | |
| 110 } | |
| 111 | |
| 112 static void JNICALL JniShowNextNotification(JNIEnv* env, jclass clazz, jlong ptr
, jstring jUrl) | |
| 113 { | |
| 114 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 115 std::string url = JniJavaToStdString(env, jUrl); | |
| 116 | |
| 117 try | |
| 118 { | |
| 119 engine.ShowNextNotification(url); | |
| 120 } | |
| 121 CATCH_AND_THROW(env); | |
| 122 } | |
| 123 | |
| 124 static void JNICALL JniSetShowNotificationCallback(JNIEnv* env, jclass clazz, | |
| 125 jlong ptr, jlong callbackPtr) | |
| 126 { | |
| 127 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 128 | |
| 129 JniShowNotificationCallback* const callback = | |
| 130 JniLongToTypePtr<JniShowNotificationCallback>(callbackPtr); | |
| 131 | |
| 132 auto showNotificationCallback = [callback](AdblockPlus::Notification&& notific
ation) | |
| 133 { | |
| 134 callback->Callback(std::move(notification)); | |
| 135 }; | |
| 136 | |
| 137 try | |
| 138 { | |
| 139 engine.SetShowNotificationCallback(showNotificationCallback); | |
| 140 } | |
| 141 CATCH_AND_THROW(env) | |
| 142 } | |
| 143 | |
| 144 static void JNICALL JniRemoveShowNotificationCallback(JNIEnv* env, jclass clazz,
jlong ptr) | |
| 145 { | |
| 146 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 147 | |
| 148 try | |
| 149 { | |
| 150 engine.RemoveShowNotificationCallback(); | |
| 151 } | |
| 152 CATCH_AND_THROW(env); | |
| 153 } | |
| 154 | |
| 155 static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon
g ptr) | |
| 156 { | |
| 157 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 158 | |
| 159 try | |
| 160 { | |
| 161 return SubscriptionsToArrayList(env, engine.GetListedSubscriptions()); | |
| 162 } | |
| 163 CATCH_THROW_AND_RETURN(env, 0); | |
| 164 } | |
| 165 | |
| 166 static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz,
jlong ptr) | |
| 167 { | |
| 168 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 169 | |
| 170 try | |
| 171 { | |
| 172 return SubscriptionsToArrayList(env, engine.FetchAvailableSubscriptions()); | |
| 173 } | |
| 174 CATCH_THROW_AND_RETURN(env, 0); | |
| 175 } | |
| 176 | |
| 177 static void JNICALL JniRemoveUpdateAvailableCallback(JNIEnv* env, jclass clazz, | |
| 178 jlong ptr) | |
| 179 { | |
| 180 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 181 try | |
| 182 { | |
| 183 engine.RemoveUpdateAvailableCallback(); | |
| 184 } | |
| 185 CATCH_AND_THROW(env) | |
| 186 } | |
| 187 | |
| 188 static void JNICALL JniSetUpdateAvailableCallback(JNIEnv* env, jclass clazz, | |
| 189 jlong ptr, jlong callbackPtr) | |
| 190 { | |
| 191 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 192 JniUpdateAvailableCallback* const callback = | |
| 193 JniLongToTypePtr<JniUpdateAvailableCallback>(callbackPtr); | |
| 194 | |
| 195 const AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallba
ck = | |
| 196 std::bind(&JniUpdateAvailableCallback::Callback, callback, | |
| 197 std::placeholders::_1); | |
| 198 try | |
| 199 { | |
| 200 engine.SetUpdateAvailableCallback(updateAvailableCallback); | |
| 201 } | |
| 202 CATCH_AND_THROW(env) | |
| 203 } | |
| 204 | |
| 205 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo
ng ptr) | |
| 206 { | |
| 207 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 208 | |
| 209 try | |
| 210 { | |
| 211 engine.RemoveFilterChangeCallback(); | |
| 212 } | |
| 213 CATCH_AND_THROW(env) | |
| 214 } | |
| 215 | |
| 216 static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz, | |
| 217 jlong ptr, jlong filterPtr) | |
| 218 { | |
| 219 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 220 JniFilterChangeCallback* callback = JniLongToTypePtr<JniFilterChangeCallback>( | |
| 221 filterPtr); | |
| 222 | |
| 223 auto filterCallback = [callback](const std::string& arg, AdblockPlus::JsValue&
& jsValue) | |
| 224 { | |
| 225 callback->Callback(arg, std::move(jsValue)); | |
| 226 }; | |
| 227 | |
| 228 try | |
| 229 { | |
| 230 engine.SetFilterChangeCallback(filterCallback); | |
| 231 } | |
| 232 CATCH_AND_THROW(env) | |
| 233 } | |
| 234 | |
| 235 static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jl
ong updaterPtr) | |
| 236 { | |
| 237 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 238 JniUpdateCheckDoneCallback* callback = | |
| 239 JniLongToTypePtr<JniUpdateCheckDoneCallback>(updaterPtr); | |
| 240 | |
| 241 AdblockPlus::FilterEngine::UpdateCheckDoneCallback | |
| 242 updateCheckDoneCallback = 0; | |
| 243 | |
| 244 if (updaterPtr) | |
| 245 { | |
| 246 updateCheckDoneCallback = | |
| 247 std::bind(&JniUpdateCheckDoneCallback::Callback, callback, | |
| 248 std::placeholders::_1); | |
| 249 } | |
| 250 | |
| 251 try | |
| 252 { | |
| 253 engine.ForceUpdateCheck(updateCheckDoneCallback); | |
| 254 } | |
| 255 CATCH_AND_THROW(env) | |
| 256 } | |
| 257 | |
| 258 static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz, | |
| 259 jlong ptr, jstring jDomain) | |
| 260 { | |
| 261 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 262 | |
| 263 std::string domain = JniJavaToStdString(env, jDomain); | |
| 264 | |
| 265 try | |
| 266 { | |
| 267 std::vector<std::string> selectors = engine.GetElementHidingSelectors( | |
| 268 domain); | |
| 269 | |
| 270 jobject list = NewJniArrayList(env); | |
| 271 | |
| 272 for (std::vector<std::string>::iterator it = selectors.begin(), end = | |
| 273 selectors.end(); it != end; it++) | |
| 274 { | |
| 275 JniAddObjectToList(env, list, | |
| 276 *JniLocalReference<jstring>(env, env->NewStringUTF(it->c_str()))); | |
| 277 } | |
| 278 | |
| 279 return list; | |
| 280 } | |
| 281 CATCH_THROW_AND_RETURN(env, 0) | |
| 282 } | |
| 283 | |
| 284 static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring
jUrl, jobject jContentType, jstring jDocumentUrl) | |
| 285 { | |
| 286 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 287 | |
| 288 std::string url = JniJavaToStdString(env, jUrl); | |
| 289 AdblockPlus::FilterEngine::ContentType contentType = | |
| 290 ConvertContentType(env, jContentType); | |
| 291 std::string documentUrl = JniJavaToStdString(env, jDocumentUrl); | |
| 292 | |
| 293 try | |
| 294 { | |
| 295 AdblockPlus::FilterPtr filterPtr = engine.Matches(url, contentType, document
Url); | |
| 296 | |
| 297 return filterPtr.get() ? NewJniFilter(env, std::move(*filterPtr)) : 0; | |
| 298 } | |
| 299 CATCH_THROW_AND_RETURN(env, 0) | |
| 300 } | |
| 301 | |
| 302 static void JavaStringArrayToStringVector(JNIEnv* env, jobjectArray jArray, | |
| 303 std::vector<std::string>& out) | |
| 304 { | |
| 305 if (jArray) | |
| 306 { | |
| 307 jsize len = env->GetArrayLength(jArray); | |
| 308 | |
| 309 for (jsize i = 0; i < len; i++) | |
| 310 { | |
| 311 out.push_back( | |
| 312 JniJavaToStdString(env, | |
| 313 *JniLocalReference<jstring>(env, | |
| 314 static_cast<jstring>( | |
| 315 env->GetObjectArrayElement(jArray, i))))); | |
| 316 } | |
| 317 } | |
| 318 } | |
| 319 | |
| 320 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, | |
| 321 jstring jUrl, jobject jContentType, jobjectArray jDocumentUrls) | |
| 322 { | |
| 323 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 324 | |
| 325 std::string url = JniJavaToStdString(env, jUrl); | |
| 326 AdblockPlus::FilterEngine::ContentType contentType = | |
| 327 ConvertContentType(env, jContentType); | |
| 328 | |
| 329 std::vector<std::string> documentUrls; | |
| 330 JavaStringArrayToStringVector(env, jDocumentUrls, documentUrls); | |
| 331 | |
| 332 try | |
| 333 { | |
| 334 AdblockPlus::FilterPtr filterPtr = engine.Matches(url, contentType, document
Urls); | |
| 335 | |
| 336 return (filterPtr.get() ? NewJniFilter(env, std::move(*filterPtr)) : 0); | |
| 337 } | |
| 338 CATCH_THROW_AND_RETURN(env, 0) | |
| 339 } | |
| 340 | |
| 341 static jboolean JNICALL JniIsDocumentWhitelisted(JNIEnv* env, jclass clazz, jlon
g ptr, | |
| 342 jstring jUrl, jobjectArray jDocumentUrls) | |
| 343 { | |
| 344 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 345 | |
| 346 std::string url = JniJavaToStdString(env, jUrl); | |
| 347 std::vector<std::string> documentUrls; | |
| 348 JavaStringArrayToStringVector(env, jDocumentUrls, documentUrls); | |
| 349 try | |
| 350 { | |
| 351 return engine.IsDocumentWhitelisted(url, documentUrls) ? | |
| 352 JNI_TRUE : JNI_FALSE; | |
| 353 } | |
| 354 CATCH_THROW_AND_RETURN(env, JNI_FALSE) | |
| 355 } | |
| 356 | |
| 357 static jboolean JNICALL JniIsElemhideWhitelisted(JNIEnv* env, jclass clazz, jlon
g ptr, | |
| 358 jstring jUrl, jobjectArray jDocumentUrls) | |
| 359 { | |
| 360 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 361 | |
| 362 std::string url = JniJavaToStdString(env, jUrl); | |
| 363 std::vector<std::string> documentUrls; | |
| 364 JavaStringArrayToStringVector(env, jDocumentUrls, documentUrls); | |
| 365 try | |
| 366 { | |
| 367 return engine.IsElemhideWhitelisted(url, documentUrls) ? | |
| 368 JNI_TRUE : JNI_FALSE; | |
| 369 } | |
| 370 CATCH_THROW_AND_RETURN(env, JNI_FALSE) | |
| 371 } | |
| 372 | |
| 373 static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring
jPref) | |
| 374 { | |
| 375 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 376 | |
| 377 std::string pref = JniJavaToStdString(env, jPref); | |
| 378 | |
| 379 try | |
| 380 { | |
| 381 return NewJniJsValue(env, engine.GetPref(pref)); | |
| 382 } | |
| 383 CATCH_THROW_AND_RETURN(env, 0) | |
| 384 } | |
| 385 | |
| 386 static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr
ef, jlong jsValue) | |
| 387 { | |
| 388 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 389 | |
| 390 std::string pref = JniJavaToStdString(env, jPref); | |
| 391 const AdblockPlus::JsValue& value = JniGetJsValue(jsValue); | |
| 392 | |
| 393 try | |
| 394 { | |
| 395 engine.SetPref(pref, value); | |
| 396 } | |
| 397 CATCH_AND_THROW(env) | |
| 398 } | |
| 399 | |
| 400 static jstring JNICALL JniGetHostFromURL(JNIEnv* env, jclass clazz, jlong ptr, j
string jurl) | |
| 401 { | |
| 402 if (jurl == NULL) | |
| 403 { | |
| 404 return NULL; | |
| 405 } | |
| 406 | |
| 407 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 408 | |
| 409 std::string url = JniJavaToStdString(env, jurl); | |
| 410 try | |
| 411 { | |
| 412 std::string host = engine.GetHostFromURL(url); | |
| 413 | |
| 414 return JniStdStringToJava(env, host); | |
| 415 } | |
| 416 CATCH_THROW_AND_RETURN(env, 0) | |
| 417 } | |
| 418 | |
| 419 static void JNICALL JniSetAllowedConnectionType(JNIEnv* env, jclass clazz, jlong
ptr, jstring jvalue) | |
| 420 { | |
| 421 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 422 | |
| 423 std::string stdValue; | |
| 424 const std::string* value = (jvalue != NULL | |
| 425 ? &(stdValue = JniJavaToStdString(env, jvalue)) | |
| 426 : NULL); | |
| 427 | |
| 428 try | |
| 429 { | |
| 430 engine.SetAllowedConnectionType(value); | |
| 431 } | |
| 432 CATCH_AND_THROW(env) | |
| 433 } | |
| 434 | |
| 435 static jstring JNICALL JniGetAllowedConnectionType(JNIEnv* env, jclass clazz, jl
ong ptr) | |
| 436 { | |
| 437 try | |
| 438 { | |
| 439 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 440 std::unique_ptr<std::string> value = engine.GetAllowedConnectionType(); | |
| 441 | |
| 442 if (value == NULL) | |
| 443 { | |
| 444 return NULL; | |
| 445 } | |
| 446 | |
| 447 return JniStdStringToJava(env, *value.get()); | |
| 448 } | |
| 449 CATCH_THROW_AND_RETURN(env, 0) | |
| 450 } | |
| 451 | |
| 452 static void JNICALL JniSetAcceptableAdsEnabled(JNIEnv* env, jclass clazz, jlong
ptr, jboolean jvalue) | |
| 453 { | |
| 454 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 455 | |
| 456 try | |
| 457 { | |
| 458 engine.SetAAEnabled(jvalue == JNI_TRUE); | |
| 459 } | |
| 460 CATCH_AND_THROW(env) | |
| 461 } | |
| 462 | |
| 463 static jboolean JNICALL JniIsAcceptableAdsEnabled(JNIEnv* env, jclass clazz, jlo
ng ptr) | |
| 464 { | |
| 465 try | |
| 466 { | |
| 467 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 468 return engine.IsAAEnabled() ? JNI_TRUE : JNI_FALSE; | |
| 469 } | |
| 470 CATCH_THROW_AND_RETURN(env, 0) | |
| 471 } | |
| 472 | |
| 473 static jstring JNICALL JniGetAcceptableAdsSubscriptionURL(JNIEnv* env, jclass cl
azz, jlong ptr) | |
| 474 { | |
| 475 try | |
| 476 { | |
| 477 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 478 std::string url = engine.GetAAUrl(); | |
| 479 return JniStdStringToJava(env, url); | |
| 480 } | |
| 481 CATCH_THROW_AND_RETURN(env, 0) | |
| 482 } | |
| 483 | |
| 484 static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong jniPl
atformPtr, jstring jSubscriptionUrl) | |
| 485 { | |
| 486 std::string subscriptionUrl = JniJavaToStdString(env, jSubscriptionUrl); | |
| 487 auto jniPlatform = JniLongToTypePtr<JniPlatform>(jniPlatformPtr); | |
| 488 jniPlatform->scheduler([jniPlatform, subscriptionUrl] | |
| 489 { | |
| 490 auto& filterEngine = jniPlatform->platform->GetFilterEngine(); | |
| 491 for (auto& subscription : filterEngine.GetListedSubscriptions()) | |
| 492 { | |
| 493 if (stringBeginsWith(subscriptionUrl, subscription.GetProperty("url").AsSt
ring())) | |
| 494 { | |
| 495 subscription.UpdateFilters(); | |
| 496 return; | |
| 497 } | |
| 498 } | |
| 499 }); | |
| 500 } | |
| 501 | |
| 502 static jlong JNICALL JniGetFilterEngineNativePtr(JNIEnv* env, jclass clazz, jlon
g ptr) | |
| 503 { | |
| 504 try | |
| 505 { | |
| 506 AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); | |
| 507 return (jlong)&engine; | |
| 508 } | |
| 509 CATCH_THROW_AND_RETURN(env, 0); | |
| 510 } | |
| 511 | |
| 512 static JNINativeMethod methods[] = | |
| 513 { | |
| 514 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, | |
| 515 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
GetFilter }, | |
| 516 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
Filters }, | |
| 517 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
, (void*)JniGetSubscription }, | |
| 518 { (char*)"showNextNotification", (char*)"(JLjava/lang/String;)V", (void*)JniSh
owNextNotification }, | |
| 519 { (char*)"setShowNotificationCallback", (char*)"(JJ)V", (void*)JniSetShowNotif
icationCallback }, | |
| 520 { (char*)"removeShowNotificationCallback", (char*)"(J)V", (void*)JniRemoveShow
NotificationCallback }, | |
| 521 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
ListedSubscriptions }, | |
| 522 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
niFetchAvailableSubscriptions }, | |
| 523 { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvai
lableCallback }, | |
| 524 { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdat
eAvailableCallback }, | |
| 525 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
allback }, | |
| 526 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
angeCallback }, | |
| 527 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, | |
| 528 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
List;", (void*)JniGetElementHidingSelectors }, | |
| 529 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches }, | |
| 530 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany }, | |
| 531 { (char*)"isDocumentWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsDocumentWhitelisted }, | |
| 532 { (char*)"isElemhideWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsElemhideWhitelisted }, | |
| 533 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
etPref }, | |
| 534 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, | |
| 535 { (char*)"getHostFromURL", (char*)"(JLjava/lang/String;)Ljava/lang/String;", (
void*)JniGetHostFromURL }, | |
| 536 { (char*)"setAllowedConnectionType", (char*)"(JLjava/lang/String;)V", (void*)J
niSetAllowedConnectionType }, | |
| 537 { (char*)"getAllowedConnectionType", (char*)"(J)Ljava/lang/String;", (void*)Jn
iGetAllowedConnectionType }, | |
| 538 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds
Enabled }, | |
| 539 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna
bled }, | |
| 540 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v
oid*)JniGetAcceptableAdsSubscriptionURL }, | |
| 541 { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpda
teFiltersAsync }, | |
| 542 { (char*)"getNativePtr", (char*)"(J)J", (void*)JniGetFilterEngineNativePtr } | |
| 543 }; | |
| 544 | |
| 545 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
ne_registerNatives(JNIEnv *env, jclass clazz) | |
| 546 { | |
| 547 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | |
| 548 } | |
| OLD | NEW |