OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 12 matching lines...) Expand all Loading... |
23 { | 23 { |
24 private final Disposer disposer; | 24 private final Disposer disposer; |
25 protected final long ptr; | 25 protected final long ptr; |
26 | 26 |
27 static | 27 static |
28 { | 28 { |
29 System.loadLibrary("adblockplus-jni"); | 29 System.loadLibrary("adblockplus-jni"); |
30 registerNatives(); | 30 registerNatives(); |
31 } | 31 } |
32 | 32 |
| 33 public static enum ContentType |
| 34 { |
| 35 OTHER, SCRIPT, IMAGE, STYLESHEET, OBJECT, SUBDOCUMENT, DOCUMENT, XMLHTTPREQU
EST, |
| 36 OBJECT_SUBREQUEST, FONT, MEDIA |
| 37 } |
| 38 |
33 public FilterEngine(final JsEngine jsEngine) | 39 public FilterEngine(final JsEngine jsEngine) |
34 { | 40 { |
35 this.ptr = ctor(jsEngine.ptr); | 41 this.ptr = ctor(jsEngine.ptr); |
36 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); | 42 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); |
37 } | 43 } |
38 | 44 |
39 public boolean isFirstRun() | 45 public boolean isFirstRun() |
40 { | 46 { |
41 return isFirstRun(this.ptr); | 47 return isFirstRun(this.ptr); |
42 } | 48 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 public void setFilterChangeCallback(final FilterChangeCallback callback) | 80 public void setFilterChangeCallback(final FilterChangeCallback callback) |
75 { | 81 { |
76 setFilterChangeCallback(this.ptr, callback.ptr); | 82 setFilterChangeCallback(this.ptr, callback.ptr); |
77 } | 83 } |
78 | 84 |
79 public void forceUpdateCheck() | 85 public void forceUpdateCheck() |
80 { | 86 { |
81 forceUpdateCheck(this.ptr, 0); | 87 forceUpdateCheck(this.ptr, 0); |
82 } | 88 } |
83 | 89 |
84 public void forceUpdateCheck(final UpdaterCallback callback) | 90 public void forceUpdateCheck(final UpdateCheckDoneCallback callback) |
85 { | 91 { |
86 forceUpdateCheck(this.ptr, callback != null ? callback.ptr : 0); | 92 forceUpdateCheck(this.ptr, callback != null ? callback.ptr : 0); |
87 } | 93 } |
88 | 94 |
89 public List<String> getElementHidingSelectors(final String domain) | 95 public List<String> getElementHidingSelectors(final String domain) |
90 { | 96 { |
91 return getElementHidingSelectors(this.ptr, domain); | 97 return getElementHidingSelectors(this.ptr, domain); |
92 } | 98 } |
93 | 99 |
94 public Filter matches(final String url, final String contentType, final String
documentUrl) | 100 public Filter matches(final String url, final ContentType contentType, final S
tring documentUrl) |
95 { | 101 { |
96 return matches(this.ptr, url, contentType, documentUrl); | 102 return matches(this.ptr, url, contentType, documentUrl); |
97 } | 103 } |
98 | 104 |
99 public Filter matches(final String url, final String contentType, final String
[] documentUrls) | 105 public Filter matches(final String url, final ContentType contentType, final S
tring[] documentUrls) |
100 { | 106 { |
101 return matches(this.ptr, url, contentType, documentUrls); | 107 return matches(this.ptr, url, contentType, documentUrls); |
102 } | 108 } |
103 | 109 |
104 public JsValue getPref(final String pref) | 110 public JsValue getPref(final String pref) |
105 { | 111 { |
106 return getPref(this.ptr, pref); | 112 return getPref(this.ptr, pref); |
107 } | 113 } |
108 | 114 |
109 public void setPref(final String pref, final JsValue value) | 115 public void setPref(final String pref, final JsValue value) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 private final static native void removeFilterChangeCallback(long ptr); | 158 private final static native void removeFilterChangeCallback(long ptr); |
153 | 159 |
154 private final static native void setFilterChangeCallback(long ptr, long filter
Ptr); | 160 private final static native void setFilterChangeCallback(long ptr, long filter
Ptr); |
155 | 161 |
156 private final static native void forceUpdateCheck(long ptr, long updatePtr); | 162 private final static native void forceUpdateCheck(long ptr, long updatePtr); |
157 | 163 |
158 private final static native List<String> getElementHidingSelectors(long ptr, S
tring domain); | 164 private final static native List<String> getElementHidingSelectors(long ptr, S
tring domain); |
159 | 165 |
160 private final static native JsValue getPref(long ptr, String pref); | 166 private final static native JsValue getPref(long ptr, String pref); |
161 | 167 |
162 private final static native Filter matches(long ptr, String url, String conten
tType, String documentUrl); | 168 private final static native Filter matches(long ptr, String url, ContentType c
ontentType, String documentUrl); |
163 | 169 |
164 private final static native Filter matches(long ptr, String url, String conten
tType, String[] documentUrls); | 170 private final static native Filter matches(long ptr, String url, ContentType c
ontentType, String[] documentUrls); |
165 | 171 |
166 private final static native void setPref(long ptr, String pref, long valuePtr)
; | 172 private final static native void setPref(long ptr, String pref, long valuePtr)
; |
167 | 173 |
168 private final static native void dtor(long ptr); | 174 private final static native void dtor(long ptr); |
169 } | 175 } |
OLD | NEW |