| OLD | NEW | 
|---|
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 135 | 135 | 
| 136   try | 136   try | 
| 137   { | 137   { | 
| 138     std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvail
     ableSubscriptions(); | 138     std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvail
     ableSubscriptions(); | 
| 139 | 139 | 
| 140     return SubscriptionsToArrayList(env, subscriptions); | 140     return SubscriptionsToArrayList(env, subscriptions); | 
| 141   } | 141   } | 
| 142   CATCH_THROW_AND_RETURN(env, 0); | 142   CATCH_THROW_AND_RETURN(env, 0); | 
| 143 } | 143 } | 
| 144 | 144 | 
|  | 145 static void JNICALL JniRemoveUpdateAvailableCallback(JNIEnv* env, jclass clazz, | 
|  | 146                                                      jlong ptr) | 
|  | 147 { | 
|  | 148   AdblockPlus::FilterEngine* const engine = | 
|  | 149       JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr); | 
|  | 150   try | 
|  | 151   { | 
|  | 152     engine->RemoveUpdateAvailableCallback(); | 
|  | 153   } | 
|  | 154   CATCH_AND_THROW(env) | 
|  | 155 } | 
|  | 156 | 
|  | 157 static void JNICALL JniSetUpdateAvailableCallback(JNIEnv* env, jclass clazz, | 
|  | 158                                                   jlong ptr, jlong callbackPtr) | 
|  | 159 { | 
|  | 160   AdblockPlus::FilterEngine* const engine = | 
|  | 161       JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr); | 
|  | 162   JniUpdateAvailableCallback* const callback = | 
|  | 163       JniLongToTypePtr<JniUpdateAvailableCallback>(callbackPtr); | 
|  | 164   AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallback = | 
|  | 165       std::tr1::bind(&JniUpdateAvailableCallback::Callback, callback, | 
|  | 166                      std::tr1::placeholders::_1); | 
|  | 167   try | 
|  | 168   { | 
|  | 169     engine->SetUpdateAvailableCallback(updateAvailableCallback); | 
|  | 170   } | 
|  | 171   CATCH_AND_THROW(env) | 
|  | 172 } | 
|  | 173 | 
| 145 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo
     ng ptr) | 174 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo
     ng ptr) | 
| 146 { | 175 { | 
| 147   AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
     >(ptr); | 176   AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine
     >(ptr); | 
| 148 | 177 | 
| 149   try | 178   try | 
| 150   { | 179   { | 
| 151     engine->RemoveFilterChangeCallback(); | 180     engine->RemoveFilterChangeCallback(); | 
| 152   } | 181   } | 
| 153   CATCH_AND_THROW(env) | 182   CATCH_AND_THROW(env) | 
| 154 } | 183 } | 
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 288 | 317 | 
| 289 static JNINativeMethod methods[] = | 318 static JNINativeMethod methods[] = | 
| 290 { | 319 { | 
| 291   { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, | 320   { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, | 
| 292   { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, | 321   { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, | 
| 293   { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
     GetFilter }, | 322   { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni
     GetFilter }, | 
| 294   { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
     Filters }, | 323   { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed
     Filters }, | 
| 295   { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
     , (void*)JniGetSubscription }, | 324   { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription")
     , (void*)JniGetSubscription }, | 
| 296   { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
     ListedSubscriptions }, | 325   { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet
     ListedSubscriptions }, | 
| 297   { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
     niFetchAvailableSubscriptions }, | 326   { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J
     niFetchAvailableSubscriptions }, | 
|  | 327   { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvai
     lableCallback }, | 
|  | 328   { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdat
     eAvailableCallback }, | 
| 298   { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
     allback }, | 329   { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC
     allback }, | 
| 299   { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
     angeCallback }, | 330   { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh
     angeCallback }, | 
| 300   { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, | 331   { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, | 
| 301   { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
     List;", (void*)JniGetElementHidingSelectors }, | 332   { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/
     List;", (void*)JniGetElementHidingSelectors }, | 
| 302   { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
     e") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches }, | 333   { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
     e") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches }, | 
| 303   { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
     e") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany }, | 334   { (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentTyp
     e") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany }, | 
| 304   { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
     etPref }, | 335   { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG
     etPref }, | 
| 305   { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, | 336   { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, | 
| 306   { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 337   { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 
| 307 }; | 338 }; | 
| 308 | 339 | 
| 309 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
     ne_registerNatives(JNIEnv *env, jclass clazz) | 340 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi
     ne_registerNatives(JNIEnv *env, jclass clazz) | 
| 310 { | 341 { | 
| 311   env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 342   env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 
| 312 } | 343 } | 
| OLD | NEW | 
|---|