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

Delta Between Two Patch Sets: libadblockplus-android/jni/Utils.cpp

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Left Patch Set: now loading elemhide selectors beforehand in bg thread Created Sept. 20, 2016, 11:42 a.m.
Right Patch Set: changed packages, now using AdblockEngine (original ABPEngine), improved demo app Created Oct. 25, 2016, 11:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « libadblockplus-android/jni/Utils.h ('k') | libadblockplus-android/pom.xml » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 13 matching lines...) Expand all
24 if (!str) 24 if (!str)
25 { 25 {
26 return std::string(); 26 return std::string();
27 } 27 }
28 28
29 const char* cStr = env->GetStringUTFChars(str, 0); 29 const char* cStr = env->GetStringUTFChars(str, 0);
30 std::string ret(cStr); 30 std::string ret(cStr);
31 env->ReleaseStringUTFChars(str, cStr); 31 env->ReleaseStringUTFChars(str, cStr);
32 32
33 return ret; 33 return ret;
34 }
35
36 jstring JniStdStringToJava(JNIEnv* env, std::string str)
37 {
38 return env->NewStringUTF(str.c_str());
34 } 39 }
35 40
36 jobject NewJniArrayList(JNIEnv* env) 41 jobject NewJniArrayList(JNIEnv* env)
37 { 42 {
38 JniLocalReference<jclass> clazz(env, env->FindClass("java/util/ArrayList")); 43 JniLocalReference<jclass> clazz(env, env->FindClass("java/util/ArrayList"));
39 jmethodID ctor = env->GetMethodID(*clazz, "<init>", "()V"); 44 jmethodID ctor = env->GetMethodID(*clazz, "<init>", "()V");
40 return env->NewObject(*clazz, ctor); 45 return env->NewObject(*clazz, ctor);
41 } 46 }
42 47
43 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value) 48 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const AdblockPlus::SubscriptionPtr& subscription) 120 const AdblockPlus::SubscriptionPtr& subscription)
116 { 121 {
117 return NewJniObject(env, subscription, PKG("Subscription")); 122 return NewJniObject(env, subscription, PKG("Subscription"));
118 } 123 }
119 124
120 jobject NewJniNotification(JNIEnv* env, 125 jobject NewJniNotification(JNIEnv* env,
121 const AdblockPlus::NotificationPtr& notification) 126 const AdblockPlus::NotificationPtr& notification)
122 { 127 {
123 return NewJniObject(env, notification, PKG("Notification")); 128 return NewJniObject(env, notification, PKG("Notification"));
124 } 129 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld