Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: jni/abpEngine.cpp

Issue 6196972490850304: Make the Acceptable Ads link clickable (Closed)
Patch Set: Encode URL Created Nov. 26, 2013, 1:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/org/adblockplus/android/ABPEngine.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(JNIE nv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl); 46 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIE nv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl);
45 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec torsForDomain(JNIEnv *pEnv, jobject, jstring domain); 47 JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getSelec torsForDomain(JNIEnv *pEnv, jobject, jstring domain);
46 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI Env *pEnv, jobject); 48 JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_checkUpdates(JNI Env *pEnv, jobject);
47 }; 49 };
48 50
49 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub scriptionPtr> subscriptions) 51 jobjectArray subscriptionsAsJavaArray(JNIEnv *pEnv, std::vector<AdblockPlus::Sub scriptionPtr> subscriptions)
50 { 52 {
51 D(D_WARN, "subscriptionsAsJavaArray()"); 53 D(D_WARN, "subscriptionsAsJavaArray()");
52 static jclass cls = reinterpret_cast<jclass>(pEnv->NewGlobalRef(pEnv->FindClas s("org/adblockplus/android/Subscription"))); 54 static jclass cls = reinterpret_cast<jclass>(pEnv->NewGlobalRef(pEnv->FindClas s("org/adblockplus/android/Subscription")));
53 static jmethodID cid = pEnv->GetMethodID(cls, "<init>", "()V"); 55 static jmethodID cid = pEnv->GetMethodID(cls, "<init>", "()V");
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 catch (const std::exception& e) 450 catch (const std::exception& e)
449 { 451 {
450 ThrowJavaException(pEnv, e); 452 ThrowJavaException(pEnv, e);
451 } 453 }
452 catch (...) 454 catch (...)
453 { 455 {
454 ThrowJavaException(pEnv); 456 ThrowJavaException(pEnv);
455 } 457 }
456 } 458 }
457 459
460 JNIEXPORT jstring JNICALL Java_org_adblockplus_android_ABPEngine_getDocumentatio nLink(
461 JNIEnv *env, jobject object)
462 {
463 const std::string documentationLink = filterEngine->GetPref("documentation_lin k")->AsString();
464 return env->NewStringUTF(documentationLink.c_str());
465 }
466
458 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIEnv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl) 467 JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_matches(JNIEnv *pEnv, jobject, jstring url, jstring contentType, jstring documentUrl)
459 { 468 {
460 try 469 try
461 { 470 {
462 const std::string surl = GetString(pEnv, url); 471 const std::string surl = GetString(pEnv, url);
463 const std::string stype = GetString(pEnv, contentType); 472 const std::string stype = GetString(pEnv, contentType);
464 const std::string sdoc = GetString(pEnv, documentUrl); 473 const std::string sdoc = GetString(pEnv, documentUrl);
465 474
466 AdblockPlus::FilterPtr filter = filterEngine->Matches(surl, stype, sdoc); 475 AdblockPlus::FilterPtr filter = filterEngine->Matches(surl, stype, sdoc);
467 476
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 540 }
532 catch (const std::exception& e) 541 catch (const std::exception& e)
533 { 542 {
534 ThrowJavaException(pEnv, e); 543 ThrowJavaException(pEnv, e);
535 } 544 }
536 catch (...) 545 catch (...)
537 { 546 {
538 ThrowJavaException(pEnv); 547 ThrowJavaException(pEnv);
539 } 548 }
540 } 549 }
OLDNEW
« no previous file with comments | « no previous file | src/org/adblockplus/android/ABPEngine.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld