OLD | NEW |
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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 System.loadLibrary("adblockplus-jni"); | 29 System.loadLibrary("adblockplus-jni"); |
30 registerNatives(); | 30 registerNatives(); |
31 } | 31 } |
32 | 32 |
33 public static enum ContentType | 33 public static enum ContentType |
34 { | 34 { |
35 OTHER, SCRIPT, IMAGE, STYLESHEET, OBJECT, SUBDOCUMENT, DOCUMENT, XMLHTTPREQU
EST, | 35 OTHER, SCRIPT, IMAGE, STYLESHEET, OBJECT, SUBDOCUMENT, DOCUMENT, XMLHTTPREQU
EST, |
36 OBJECT_SUBREQUEST, FONT, MEDIA | 36 OBJECT_SUBREQUEST, FONT, MEDIA |
37 } | 37 } |
38 | 38 |
39 public FilterEngine(final JsEngine jsEngine, final IsAllowedConnectionCallback
isAllowedConnectionCallback) | 39 public FilterEngine(final JsEngine jsEngine, final IsAllowedConnectionCallback
isSubscriptionDownloadAllowedCallback) |
40 { | 40 { |
41 long jisAllowedConnectionCallbackPtr = | 41 this.ptr = ctor(jsEngine.ptr, isSubscriptionDownloadAllowedCallback); |
42 (isAllowedConnectionCallback != null | |
43 ? isAllowedConnectionCallback.ptr | |
44 : 0l); | |
45 this.ptr = ctor(jsEngine.ptr, jisAllowedConnectionCallbackPtr); | |
46 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); | 42 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); |
47 } | 43 } |
48 | 44 |
49 public FilterEngine(final JsEngine jsEngine) | 45 public FilterEngine(final JsEngine jsEngine) |
50 { | 46 { |
51 this(jsEngine, null); | 47 this(jsEngine, null); |
52 } | 48 } |
53 | 49 |
54 public boolean isFirstRun() | 50 public boolean isFirstRun() |
55 { | 51 { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 219 |
224 @Override | 220 @Override |
225 public void dispose() | 221 public void dispose() |
226 { | 222 { |
227 dtor(this.ptr); | 223 dtor(this.ptr); |
228 } | 224 } |
229 } | 225 } |
230 | 226 |
231 private final static native void registerNatives(); | 227 private final static native void registerNatives(); |
232 | 228 |
233 private final static native long ctor(long jsEnginePtr, long isAllowedConnecti
onCallbackPtr); | 229 private final static native long ctor(long jsEnginePtr, IsAllowedConnectionCal
lback isSubscriptionDownloadAllowedCallback); |
234 | 230 |
235 private final static native boolean isFirstRun(long ptr); | 231 private final static native boolean isFirstRun(long ptr); |
236 | 232 |
237 private final static native Filter getFilter(long ptr, String text); | 233 private final static native Filter getFilter(long ptr, String text); |
238 | 234 |
239 private final static native List<Filter> getListedFilters(long ptr); | 235 private final static native List<Filter> getListedFilters(long ptr); |
240 | 236 |
241 private final static native Subscription getSubscription(long ptr, String url)
; | 237 private final static native Subscription getSubscription(long ptr, String url)
; |
242 | 238 |
243 private final static native List<Subscription> getListedSubscriptions(long ptr
); | 239 private final static native List<Subscription> getListedSubscriptions(long ptr
); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 private final static native void setAcceptableAdsEnabled(long ptr, boolean ena
bled); | 279 private final static native void setAcceptableAdsEnabled(long ptr, boolean ena
bled); |
284 | 280 |
285 private final static native boolean isAcceptableAdsEnabled(long ptr); | 281 private final static native boolean isAcceptableAdsEnabled(long ptr); |
286 | 282 |
287 private final static native String getAcceptableAdsSubscriptionURL(long ptr); | 283 private final static native String getAcceptableAdsSubscriptionURL(long ptr); |
288 | 284 |
289 private final static native void updateFiltersAsync(long ptr, String subscript
ionUrl); | 285 private final static native void updateFiltersAsync(long ptr, String subscript
ionUrl); |
290 | 286 |
291 private final static native void dtor(long ptr); | 287 private final static native void dtor(long ptr); |
292 } | 288 } |
OLD | NEW |