OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 { | 492 { |
493 if (stringBeginsWith(subscriptionUrl, subscription.GetProperty("url").AsSt
ring())) | 493 if (stringBeginsWith(subscriptionUrl, subscription.GetProperty("url").AsSt
ring())) |
494 { | 494 { |
495 subscription.UpdateFilters(); | 495 subscription.UpdateFilters(); |
496 return; | 496 return; |
497 } | 497 } |
498 } | 498 } |
499 }); | 499 }); |
500 } | 500 } |
501 | 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 |
502 static JNINativeMethod methods[] = | 512 static JNINativeMethod methods[] = |
503 { | 513 { |
504 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, | 514 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, |
505 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
GetFilter }, | 515 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
GetFilter }, |
506 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
Filters }, | 516 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
Filters }, |
507 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
, (void*)JniGetSubscription }, | 517 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
, (void*)JniGetSubscription }, |
508 { (char*)"showNextNotification", (char*)"(JLjava/lang/String;)V", (void*)JniSh
owNextNotification }, | 518 { (char*)"showNextNotification", (char*)"(JLjava/lang/String;)V", (void*)JniSh
owNextNotification }, |
509 { (char*)"setShowNotificationCallback", (char*)"(JJ)V", (void*)JniSetShowNotif
icationCallback }, | 519 { (char*)"setShowNotificationCallback", (char*)"(JJ)V", (void*)JniSetShowNotif
icationCallback }, |
510 { (char*)"removeShowNotificationCallback", (char*)"(J)V", (void*)JniRemoveShow
NotificationCallback }, | 520 { (char*)"removeShowNotificationCallback", (char*)"(J)V", (void*)JniRemoveShow
NotificationCallback }, |
511 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
ListedSubscriptions }, | 521 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
ListedSubscriptions }, |
512 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
niFetchAvailableSubscriptions }, | 522 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
niFetchAvailableSubscriptions }, |
513 { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvai
lableCallback }, | 523 { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvai
lableCallback }, |
514 { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdat
eAvailableCallback }, | 524 { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdat
eAvailableCallback }, |
515 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
allback }, | 525 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
allback }, |
516 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
angeCallback }, | 526 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
angeCallback }, |
517 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, | 527 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, |
518 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
List;", (void*)JniGetElementHidingSelectors }, | 528 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
List;", (void*)JniGetElementHidingSelectors }, |
519 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches }, | 529 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches }, |
520 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany }, | 530 { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
e") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany }, |
521 { (char*)"isDocumentWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsDocumentWhitelisted }, | 531 { (char*)"isDocumentWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsDocumentWhitelisted }, |
522 { (char*)"isElemhideWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsElemhideWhitelisted }, | 532 { (char*)"isElemhideWhitelisted", (char*)"(JLjava/lang/String;[Ljava/lang/Stri
ng;)Z", (void*)JniIsElemhideWhitelisted }, |
523 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
etPref }, | 533 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
etPref }, |
524 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, | 534 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, |
525 { (char*)"getHostFromURL", (char*)"(JLjava/lang/String;)Ljava/lang/String;", (
void*)JniGetHostFromURL }, | 535 { (char*)"getHostFromURL", (char*)"(JLjava/lang/String;)Ljava/lang/String;", (
void*)JniGetHostFromURL }, |
526 { (char*)"setAllowedConnectionType", (char*)"(JLjava/lang/String;)V", (void*)J
niSetAllowedConnectionType }, | 536 { (char*)"setAllowedConnectionType", (char*)"(JLjava/lang/String;)V", (void*)J
niSetAllowedConnectionType }, |
527 { (char*)"getAllowedConnectionType", (char*)"(J)Ljava/lang/String;", (void*)Jn
iGetAllowedConnectionType }, | 537 { (char*)"getAllowedConnectionType", (char*)"(J)Ljava/lang/String;", (void*)Jn
iGetAllowedConnectionType }, |
528 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds
Enabled }, | 538 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds
Enabled }, |
529 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna
bled }, | 539 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna
bled }, |
530 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v
oid*)JniGetAcceptableAdsSubscriptionURL }, | 540 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v
oid*)JniGetAcceptableAdsSubscriptionURL }, |
531 { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpda
teFiltersAsync } | 541 { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpda
teFiltersAsync }, |
| 542 { (char*)"getNativePtr", (char*)"(J)J", (void*)JniGetFilterEngineNativePtr } |
532 }; | 543 }; |
533 | 544 |
534 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
ne_registerNatives(JNIEnv *env, jclass clazz) | 545 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
ne_registerNatives(JNIEnv *env, jclass clazz) |
535 { | 546 { |
536 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 547 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
537 } | 548 } |
OLD | NEW |