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

Unified Diff: jni/JniFilterEngine.cpp

Issue 5327480814567424: Issue 1108 - Support notifications (Closed)
Patch Set: Even more renaming, ignore INVALID/QUESTION Created Feb. 18, 2015, 3 p.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: jni/JniFilterEngine.cpp
diff --git a/jni/JniFilterEngine.cpp b/jni/JniFilterEngine.cpp
index 557002b01fe56d2ba1a251d7ba31b7db9126a310..fb1a0fe42c4f8ce331f6c0a8f50298c0b3828141 100644
--- a/jni/JniFilterEngine.cpp
+++ b/jni/JniFilterEngine.cpp
@@ -118,6 +118,20 @@ static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
CATCH_THROW_AND_RETURN(env, 0);
}
+static jobject JNICALL JniGetNextNotificationToShow(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl)
+{
+ AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
+ std::string url = JniJavaToStdString(env, jUrl);
+
+ try
+ {
+ AdblockPlus::NotificationPtr notification = engine->GetNextNotificationToShow(url);
+
+ return NewJniNotification(env, notification);
+ }
+ CATCH_THROW_AND_RETURN(env, 0);
+}
+
static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlong ptr)
{
AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
@@ -340,6 +354,7 @@ static JNINativeMethod methods[] =
{ (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)JniGetFilter },
{ (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListedFilters },
{ (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription"), (void*)JniGetSubscription },
+ { (char*)"getNextNotificationToShow", (char*)"(JLjava/lang/String;)" TYP("Notification"), (void*)JniGetNextNotificationToShow },
{ (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGetListedSubscriptions },
{ (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniFetchAvailableSubscriptions },
{ (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvailableCallback },

Powered by Google App Engine
This is Rietveld