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: Removed unused import, cleaned up formatting." Created Feb. 17, 2015, 1:54 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..8bc372a373a7e4946c2d050d752a7ff99b8d563e 100644
--- a/jni/JniFilterEngine.cpp
+++ b/jni/JniFilterEngine.cpp
@@ -118,6 +118,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)
Felix Dahlke 2015/02/18 12:49:56 Should be called JniGetNextNotificationToShow, in
René Jeschke 2015/02/18 13:13:02 Done.
+{
+ AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
+ std::string url;
+ if (jUrl)
Felix Dahlke 2015/02/18 12:49:56 Nit: JniJavaToStdString already does convert a nul
René Jeschke 2015/02/18 13:13:02 Hehe, ehem, sure ... I've written the function ...
+ {
+ 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 +358,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/JniNotification.cpp » ('j') | jni/JniNotification.cpp » ('J')

Powered by Google App Engine
This is Rietveld