Left: | ||
Right: |
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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 23 matching lines...) Expand all Loading... | |
34 jstring sdkVersion, jstring locale, jboolean developmentBuild); | 34 jstring sdkVersion, jstring locale, jboolean developmentBuild); |
35 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_release(JNIEnv * pEnv, jobject); | 35 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_release(JNIEnv * pEnv, jobject); |
36 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_isFirstRun(J NIEnv *pEnv, jobject); | 36 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_isFirstRun(J NIEnv *pEnv, jobject); |
37 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getListe dSubscriptions(JNIEnv *pEnv, jobject); | 37 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getListe dSubscriptions(JNIEnv *pEnv, jobject); |
38 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getRecom mendedSubscriptions(JNIEnv *pEnv, jobject); | 38 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getRecom mendedSubscriptions(JNIEnv *pEnv, jobject); |
39 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_addSubscription( JNIEnv *pEnv, jobject, jstring url); | 39 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_addSubscription( JNIEnv *pEnv, jobject, jstring url); |
40 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_removeSubscripti on(JNIEnv *pEnv, jobject, jstring url); | 40 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_removeSubscripti on(JNIEnv *pEnv, jobject, jstring url); |
41 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_refreshSubscript ion(JNIEnv *pEnv, jobject, jstring url); | 41 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_refreshSubscript ion(JNIEnv *pEnv, jobject, jstring url); |
42 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_actualizeSubscri ptionStatus(JNIEnv *pEnv, jobject, jstring url); | 42 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_actualizeSubscri ptionStatus(JNIEnv *pEnv, jobject, jstring url); |
43 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_setAcceptableAds Enabled(JNIEnv *pEnv, jobject, jboolean enabled); | 43 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_setAcceptableAds Enabled(JNIEnv *pEnv, jobject, jboolean enabled); |
44 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_setNotifiedAbout AcceptableAds( | |
45 JNIEnv* env, jobject object, jboolean notified); | |
46 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_isNotifiedAb outAcceptableAds( | |
47 JNIEnv* env, jobject object); | |
44 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentat ionLink( | 48 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentat ionLink( |
45 JNIEnv *env, jobject object); | 49 JNIEnv *env, jobject object); |
46 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIE nv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl); | 50 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIE nv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl); |
47 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec torsForDomain(JNIEnv *pEnv, jobject, jstring domain); | 51 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec torsForDomain(JNIEnv *pEnv, jobject, jstring domain); |
48 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI Env *pEnv, jobject); | 52 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI Env *pEnv, jobject); |
49 }; | 53 }; |
50 | 54 |
51 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub scriptionPtr> subscriptions) | 55 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub scriptionPtr> subscriptions) |
52 { | 56 { |
53 D(D_WARN, "subscriptionsAsJavaArray()"); | 57 D(D_WARN, "subscriptionsAsJavaArray()"); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 } | 461 } |
458 } | 462 } |
459 | 463 |
460 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentatio nLink( | 464 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentatio nLink( |
461 JNIEnv *env, jobject object) | 465 JNIEnv *env, jobject object) |
462 { | 466 { |
463 const std::string documentationLink = filterEngine->GetPref("documentation_lin k")->AsString(); | 467 const std::string documentationLink = filterEngine->GetPref("documentation_lin k")->AsString(); |
464 return env->NewStringUTF(documentationLink.c_str()); | 468 return env->NewStringUTF(documentationLink.c_str()); |
465 } | 469 } |
466 | 470 |
471 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_setNotifiedAboutAc ceptableAds( | |
472 JNIEnv* env, jobject object, jboolean notified) | |
473 { | |
474 AdblockPlus::JsEnginePtr jsEngine = filterEngine->GetJsEngine(); | |
475 filterEngine->SetPref("notified_about_acceptable_ads", jsEngine->NewValue(noti fied)); | |
Wladimir Palant
2013/11/26 11:01:02
This won't do anything, prefs that aren't defined
Felix Dahlke
2013/11/26 13:59:31
Done. Wasn't aware of that. IMO, it doesn't make s
| |
476 } | |
477 | |
478 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_isNotifiedAbou tAcceptableAds( | |
479 JNIEnv* env, jobject object) | |
480 { | |
481 return filterEngine->GetPref("notified_about_acceptable_ads")->AsBool(); | |
482 } | |
483 | |
467 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIEnv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl) | 484 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIEnv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl) |
468 { | 485 { |
469 try | 486 try |
470 { | 487 { |
471 const std::string surl = GetString(pEnv, url); | 488 const std::string surl = GetString(pEnv, url); |
472 const std::string stype = GetString(pEnv, contentType); | 489 const std::string stype = GetString(pEnv, contentType); |
473 const std::string sdoc = GetString(pEnv, documentUrl); | 490 const std::string sdoc = GetString(pEnv, documentUrl); |
474 | 491 |
475 AdblockPlus::FilterPtr filter = filterEngine->Matches(surl, stype, sdoc); | 492 AdblockPlus::FilterPtr filter = filterEngine->Matches(surl, stype, sdoc); |
476 | 493 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 } | 557 } |
541 catch (const std::exception& e) | 558 catch (const std::exception& e) |
542 { | 559 { |
543 ThrowJavaException(pEnv, e); | 560 ThrowJavaException(pEnv, e); |
544 } | 561 } |
545 catch (...) | 562 catch (...) |
546 { | 563 { |
547 ThrowJavaException(pEnv); | 564 ThrowJavaException(pEnv); |
548 } | 565 } |
549 } | 566 } |
OLD | NEW |