Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 package org.adblockplus.libadblockplus; | 18 package org.adblockplus.libadblockplus; |
19 | 19 |
20 import java.util.List; | 20 import java.util.List; |
21 | 21 |
22 public final class FilterEngine | 22 public final class FilterEngine |
23 { | 23 { |
24 protected final long ptr; | 24 protected final long ptr; |
anton
2017/09/06 06:21:27
since now it's platform ptr, not filter engine ptr
| |
25 | 25 |
26 static | 26 static |
27 { | 27 { |
28 System.loadLibrary("adblockplus-jni"); | 28 System.loadLibrary("adblockplus-jni"); |
29 registerNatives(); | 29 registerNatives(); |
30 } | 30 } |
31 | 31 |
32 public static enum ContentType | 32 public static enum ContentType |
33 { | 33 { |
34 OTHER, SCRIPT, IMAGE, STYLESHEET, OBJECT, SUBDOCUMENT, DOCUMENT, XMLHTTPREQU EST, | 34 OTHER, SCRIPT, IMAGE, STYLESHEET, OBJECT, SUBDOCUMENT, DOCUMENT, WEBSOCKET, |
35 OBJECT_SUBREQUEST, FONT, MEDIA | 35 WEBRTC, PING, XMLHTTPREQUEST, OBJECT_SUBREQUEST, MEDIA, FONT, GENERICBLOCK, |
36 } | 36 ELEMHIDE, GENERICHIDE |
37 | 37 } |
38 FilterEngine(/* JniPlatform */long ptr) | 38 |
anton
2017/09/06 06:21:27
if it's renamed to `platformPtr` there is no need
anton
2017/09/06 06:21:27
`public` here is required. Otherwise it's `package
sergei
2017/09/08 09:45:01
Totally agree with the constructor argument, renam
sergei
2017/09/08 09:45:01
I actually wanted it, so FilterEngine can be creat
anton
2017/09/08 10:19:19
Let's make it `public`.
We did not introduce `pack
sergei
2017/09/08 12:25:30
But in this case anyone can call a constructor of
diegocarloslima
2017/09/08 20:42:41
Since this project is meant to be distributed as a
| |
39 { | 39 FilterEngine(long jniPlatformPtr) |
40 this.ptr = ptr; | 40 { |
41 this.ptr = jniPlatformPtr; | |
41 } | 42 } |
42 | 43 |
43 public boolean isFirstRun() | 44 public boolean isFirstRun() |
44 { | 45 { |
45 return isFirstRun(this.ptr); | 46 return isFirstRun(this.ptr); |
46 } | 47 } |
47 | 48 |
48 public Filter getFilter(final String text) | 49 public Filter getFilter(final String text) |
49 { | 50 { |
50 return getFilter(this.ptr, text); | 51 return getFilter(this.ptr, text); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 * @param subscriptionUrl may contain query parameters, only the beginning of the string is used | 191 * @param subscriptionUrl may contain query parameters, only the beginning of the string is used |
191 * to find a corresponding subscription. | 192 * to find a corresponding subscription. |
192 */ | 193 */ |
193 public void updateFiltersAsync(String subscriptionUrl) | 194 public void updateFiltersAsync(String subscriptionUrl) |
194 { | 195 { |
195 updateFiltersAsync(this.ptr, subscriptionUrl); | 196 updateFiltersAsync(this.ptr, subscriptionUrl); |
196 } | 197 } |
197 | 198 |
198 private final static native void registerNatives(); | 199 private final static native void registerNatives(); |
199 | 200 |
200 private final static native boolean isFirstRun(long ptr); | 201 private final static native boolean isFirstRun(long ptr); |
anton
2017/09/06 06:21:27
i'd suggest to rename all `ptr` to `platformPtr` i
sergei
2017/09/08 09:45:01
see my thoughts about opaque pointer role, let's d
| |
201 | 202 |
202 private final static native Filter getFilter(long ptr, String text); | 203 private final static native Filter getFilter(long ptr, String text); |
203 | 204 |
204 private final static native List<Filter> getListedFilters(long ptr); | 205 private final static native List<Filter> getListedFilters(long ptr); |
205 | 206 |
206 private final static native Subscription getSubscription(long ptr, String url) ; | 207 private final static native Subscription getSubscription(long ptr, String url) ; |
207 | 208 |
208 private final static native List<Subscription> getListedSubscriptions(long ptr ); | 209 private final static native List<Subscription> getListedSubscriptions(long ptr ); |
209 | 210 |
210 private final static native List<Subscription> fetchAvailableSubscriptions(lon g ptr); | 211 private final static native List<Subscription> fetchAvailableSubscriptions(lon g ptr); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 private final static native String getAllowedConnectionType(long ptr); | 247 private final static native String getAllowedConnectionType(long ptr); |
247 | 248 |
248 private final static native void setAcceptableAdsEnabled(long ptr, boolean ena bled); | 249 private final static native void setAcceptableAdsEnabled(long ptr, boolean ena bled); |
249 | 250 |
250 private final static native boolean isAcceptableAdsEnabled(long ptr); | 251 private final static native boolean isAcceptableAdsEnabled(long ptr); |
251 | 252 |
252 private final static native String getAcceptableAdsSubscriptionURL(long ptr); | 253 private final static native String getAcceptableAdsSubscriptionURL(long ptr); |
253 | 254 |
254 private final static native void updateFiltersAsync(long ptr, String subscript ionUrl); | 255 private final static native void updateFiltersAsync(long ptr, String subscript ionUrl); |
255 } | 256 } |
LEFT | RIGHT |