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

Delta Between Two Patch Sets: libadblockplus-android/jni/JniFilterEngine.cpp

Issue 29405564: Issue 5121 - Use Acceptable Ads API in libadblockplus (Closed)
Left Patch Set: updated dependency to -binaries Created April 7, 2017, 10:14 a.m.
Right Patch Set: minor cleanup suggestions by Serge Created May 4, 2017, 6:17 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 engine->SetAAEnabled((bool)(jvalue == JNI_TRUE)); 497 engine->SetAAEnabled((bool)(jvalue == JNI_TRUE));
498 } 498 }
499 CATCH_AND_THROW(env) 499 CATCH_AND_THROW(env)
500 } 500 }
501 501
502 static jboolean JNICALL JniIsAcceptableAdsEnabled(JNIEnv* env, jclass clazz, jlo ng ptr) 502 static jboolean JNICALL JniIsAcceptableAdsEnabled(JNIEnv* env, jclass clazz, jlo ng ptr)
503 { 503 {
504 try 504 try
505 { 505 {
506 AdblockPlus::FilterEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::Filter EnginePtr>(ptr); 506 AdblockPlus::FilterEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::Filter EnginePtr>(ptr);
507 return (engine->IsAAEnabled() ? JNI_TRUE : JNI_FALSE); 507 return engine->IsAAEnabled() ? JNI_TRUE : JNI_FALSE;
508 } 508 }
509 CATCH_THROW_AND_RETURN(env, 0) 509 CATCH_THROW_AND_RETURN(env, 0)
510 } 510 }
511 511
512 static jstring JNICALL JniGetAcceptableAdsSubscriptionURL(JNIEnv* env, jclass cl azz, jlong ptr) 512 static jstring JNICALL JniGetAcceptableAdsSubscriptionURL(JNIEnv* env, jclass cl azz, jlong ptr)
513 { 513 {
514 try 514 try
515 { 515 {
516 AdblockPlus::FilterEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::Filter EnginePtr>(ptr); 516 AdblockPlus::FilterEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::Filter EnginePtr>(ptr);
517 std::string url = engine->GetAAUrl(); 517 std::string url = engine->GetAAUrl();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds Enabled }, 550 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds Enabled },
551 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled }, 551 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled },
552 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL }, 552 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL },
553 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 553 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
554 }; 554 };
555 555
556 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz) 556 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz)
557 { 557 {
558 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 558 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
559 } 559 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld