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: Created Jan. 30, 2015, 12:44 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
« no previous file with comments | « jni/Android.mk ('k') | jni/JniJsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jni/JniFilterEngine.cpp
diff --git a/jni/JniFilterEngine.cpp b/jni/JniFilterEngine.cpp
index 7976902711d9e59dd5038bce35cea432d6b40876..edefeb507e531528e73af1351226b2a437a27c52 100644
--- a/jni/JniFilterEngine.cpp
+++ b/jni/JniFilterEngine.cpp
@@ -116,6 +116,24 @@ static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
CATCH_THROW_AND_RETURN(env, 0);
}
+static jobject JNICALL JniGetNotificationToShow(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl)
+{
+ AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
+ std::string url;
+ if (jUrl)
+ {
+ 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);
@@ -322,6 +340,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*)"getNotificationToShow", (char*)"(JLjava/lang/String;)" TYP("Notification"), (void*)JniGetNotificationToShow },
{ (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 },
« no previous file with comments | « jni/Android.mk ('k') | jni/JniJsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld