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-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 jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentat
ionLink( |
| 45 JNIEnv *env, jobject object); |
44 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches( | 46 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches( |
45 JNIEnv *pEnv, jobject, jstring url, jstring contentType, jobjectArray docume
ntUrls); | 47 JNIEnv *pEnv, jobject, jstring url, jstring contentType, jobjectArray docu
mentUrls); |
46 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec
torsForDomain(JNIEnv *pEnv, jobject, jstring domain); | 48 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec
torsForDomain(JNIEnv *pEnv, jobject, jstring domain); |
47 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI
Env *pEnv, jobject); | 49 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI
Env *pEnv, jobject); |
48 }; | 50 }; |
49 | 51 |
50 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub
scriptionPtr> subscriptions) | 52 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub
scriptionPtr> subscriptions) |
51 { | 53 { |
52 D(D_WARN, "subscriptionsAsJavaArray()"); | 54 D(D_WARN, "subscriptionsAsJavaArray()"); |
53 static jclass cls = reinterpret_cast<jclass>(pEnv->NewGlobalRef(pEnv->FindClas
s("org/adblockplus/android/Subscription"))); | 55 static jclass cls = reinterpret_cast<jclass>(pEnv->NewGlobalRef(pEnv->FindClas
s("org/adblockplus/android/Subscription"))); |
54 static jmethodID cid = pEnv->GetMethodID(cls, "<init>", "()V"); | 56 static jmethodID cid = pEnv->GetMethodID(cls, "<init>", "()V"); |
55 static jfieldID ftitle = pEnv->GetFieldID(cls, "title", "Ljava/lang/String;"); | 57 static jfieldID ftitle = pEnv->GetFieldID(cls, "title", "Ljava/lang/String;"); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 catch (const std::exception& e) | 451 catch (const std::exception& e) |
450 { | 452 { |
451 ThrowJavaException(pEnv, e); | 453 ThrowJavaException(pEnv, e); |
452 } | 454 } |
453 catch (...) | 455 catch (...) |
454 { | 456 { |
455 ThrowJavaException(pEnv); | 457 ThrowJavaException(pEnv); |
456 } | 458 } |
457 } | 459 } |
458 | 460 |
| 461 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentatio
nLink( |
| 462 JNIEnv *env, jobject object) |
| 463 { |
| 464 const std::string documentationLink = filterEngine->GetPref("documentation_lin
k")->AsString(); |
| 465 return env->NewStringUTF(documentationLink.c_str()); |
| 466 } |
| 467 |
459 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches( | 468 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches( |
460 JNIEnv *pEnv, jobject, jstring url, jstring contentType, jobjectArray document
Urls) | 469 JNIEnv *pEnv, jobject, jstring url, jstring contentType, jobjectArray document
Urls) |
461 { | 470 { |
462 try | 471 try |
463 { | 472 { |
464 const std::string surl = GetString(pEnv, url); | 473 const std::string surl = GetString(pEnv, url); |
465 const std::string stype = GetString(pEnv, contentType); | 474 const std::string stype = GetString(pEnv, contentType); |
466 const int documentUrlsLength = pEnv->GetArrayLength(documentUrls); | 475 const int documentUrlsLength = pEnv->GetArrayLength(documentUrls); |
467 std::vector<std::string> sdocumentUrls; | 476 std::vector<std::string> sdocumentUrls; |
468 for(int i = 0; i < documentUrlsLength; i++) | 477 for(int i = 0; i < documentUrlsLength; i++) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 549 } |
541 catch (const std::exception& e) | 550 catch (const std::exception& e) |
542 { | 551 { |
543 ThrowJavaException(pEnv, e); | 552 ThrowJavaException(pEnv, e); |
544 } | 553 } |
545 catch (...) | 554 catch (...) |
546 { | 555 { |
547 ThrowJavaException(pEnv); | 556 ThrowJavaException(pEnv); |
548 } | 557 } |
549 } | 558 } |
LEFT | RIGHT |