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

Unified Diff: libadblockplus-android/jni/JniSubscription.cpp

Issue 29435570: Issue 5205 - Add Subscription.isDisabled() (Closed)
Patch Set: removed one more [unnecessary] casting Created May 26, 2017, 5:50 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/jni/JniSubscription.cpp
diff --git a/libadblockplus-android/jni/JniSubscription.cpp b/libadblockplus-android/jni/JniSubscription.cpp
index bbf2c22583d59e2aedbe943ddc51691061e66e00..3abe06cb22d0b3f2d27160d2061db3a1d0d8359f 100644
--- a/libadblockplus-android/jni/JniSubscription.cpp
+++ b/libadblockplus-android/jni/JniSubscription.cpp
@@ -24,6 +24,24 @@ static AdblockPlus::Subscription* GetSubscriptionPtr(jlong ptr)
return JniLongToTypePtr<AdblockPlus::Subscription>(ptr);
}
+static jboolean JNICALL JniIsDisabled(JNIEnv* env, jclass clazz, jlong ptr)
+{
+ try
+ {
+ return GetSubscriptionPtr(ptr)->IsDisabled() ? JNI_TRUE : JNI_FALSE;
+ }
+ CATCH_THROW_AND_RETURN(env, JNI_FALSE)
+}
+
+static void JNICALL JniSetDisabled(JNIEnv* env, jclass clazz, jlong ptr, jboolean disabled)
+{
+ try
+ {
+ return GetSubscriptionPtr(ptr)->SetDisabled(disabled == JNI_TRUE);
+ }
+ CATCH_AND_THROW(env)
+}
+
static jboolean JNICALL JniIsListed(JNIEnv* env, jclass clazz, jlong ptr)
{
try
@@ -92,6 +110,8 @@ static jboolean JNICALL JniIsAcceptableAds(JNIEnv* env, jclass clazz, jlong ptr)
static JNINativeMethod methods[] =
{
+ { (char*)"isDisabled", (char*)"(J)Z", (void*)JniIsDisabled },
+ { (char*)"setDisabled", (char*)"(JZ)V", (void*)JniSetDisabled },
{ (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed },
{ (char*)"addToList", (char*)"(J)V", (void*)JniAddToList },
{ (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList },

Powered by Google App Engine
This is Rietveld