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

Side by Side Diff: libadblockplus-android/jni/JniSubscription.cpp

Issue 29405564: Issue 5121 - Use Acceptable Ads API in libadblockplus (Closed)
Patch Set: Created April 7, 2017, 7:03 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 AdblockPlus::Subscription* me = GetSubscriptionPtr(ptr); 74 AdblockPlus::Subscription* me = GetSubscriptionPtr(ptr);
75 AdblockPlus::Subscription* other = GetSubscriptionPtr(otherPtr); 75 AdblockPlus::Subscription* other = GetSubscriptionPtr(otherPtr);
76 76
77 try 77 try
78 { 78 {
79 return *me == *other ? JNI_TRUE : JNI_FALSE; 79 return *me == *other ? JNI_TRUE : JNI_FALSE;
80 } 80 }
81 CATCH_THROW_AND_RETURN(env, JNI_FALSE) 81 CATCH_THROW_AND_RETURN(env, JNI_FALSE)
82 } 82 }
83 83
84 static jboolean JNICALL JniIsAcceptableAds(JNIEnv* env, jclass clazz, jlong ptr)
85 {
86 try
87 {
88 return (GetSubscriptionPtr(ptr)->IsAA() ? JNI_TRUE : JNI_FALSE);
89 }
90 CATCH_THROW_AND_RETURN(env, JNI_FALSE)
91 }
92
84 static JNINativeMethod methods[] = 93 static JNINativeMethod methods[] =
85 { 94 {
86 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed }, 95 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed },
87 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList }, 96 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList },
88 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, 97 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList },
89 { (char*)"updateFilters", (char*)"(J)V", (void*)JniUpdateFilters }, 98 { (char*)"updateFilters", (char*)"(J)V", (void*)JniUpdateFilters },
90 { (char*)"isUpdating", (char*)"(J)Z", (void*)JniIsUpdating }, 99 { (char*)"isUpdating", (char*)"(J)Z", (void*)JniIsUpdating },
91 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } 100 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals },
101 { (char*)"isAcceptableAds", (char*)"(J)Z", (void*)JniIsAcceptableAds },
92 }; 102 };
93 103
94 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Subscripti on_registerNatives(JNIEnv *env, jclass clazz) 104 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Subscripti on_registerNatives(JNIEnv *env, jclass clazz)
95 { 105 {
96 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 106 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
97 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld