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 14 matching lines...) Expand all Loading... |
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 JsEngine(final AppInfo appInfo, final LogSystem logSystem) | 33 public JsEngine(final AppInfo appInfo, final LogSystem logSystem) |
34 { | 34 { |
35 this(ctor(appInfo, logSystem != null ? logSystem.ptr : 0)); | 35 this(ctor(appInfo, logSystem)); |
36 } | 36 } |
37 | 37 |
38 public JsEngine(final AppInfo appInfo) | 38 public JsEngine(final AppInfo appInfo) |
39 { | 39 { |
40 this(appInfo, null); | 40 this(appInfo, null); |
41 } | 41 } |
42 | 42 |
43 protected JsEngine(final long ptr) | 43 protected JsEngine(final long ptr) |
44 { | 44 { |
45 this.ptr = ptr; | 45 this.ptr = ptr; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 @Override | 126 @Override |
127 public void dispose() | 127 public void dispose() |
128 { | 128 { |
129 dtor(this.ptr); | 129 dtor(this.ptr); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 private final static native void registerNatives(); | 133 private final static native void registerNatives(); |
134 | 134 |
135 private final static native long ctor(AppInfo appInfo, long logSystemPtr); | 135 private final static native long ctor(AppInfo appInfo, LogSystem logSystem); |
136 | 136 |
137 private final static native void setEventCallback(long ptr, String eventName,
long callback); | 137 private final static native void setEventCallback(long ptr, String eventName,
long callback); |
138 | 138 |
139 private final static native void removeEventCallback(long ptr, String eventNam
e); | 139 private final static native void removeEventCallback(long ptr, String eventNam
e); |
140 | 140 |
141 private final static native JsValue evaluate(long ptr, String source, String f
ilename); | 141 private final static native JsValue evaluate(long ptr, String source, String f
ilename); |
142 | 142 |
143 private final static native void triggerEvent(long ptr, String eventName, long
[] args); | 143 private final static native void triggerEvent(long ptr, String eventName, long
[] args); |
144 | 144 |
145 private final static native void setDefaultFileSystem(long ptr, String basePat
h); | 145 private final static native void setDefaultFileSystem(long ptr, String basePat
h); |
146 | 146 |
147 private final static native void setWebRequest(long ptr, long webRequestPtr); | 147 private final static native void setWebRequest(long ptr, long webRequestPtr); |
148 | 148 |
149 private final static native JsValue newValue(long ptr, long value); | 149 private final static native JsValue newValue(long ptr, long value); |
150 | 150 |
151 private final static native JsValue newValue(long ptr, boolean value); | 151 private final static native JsValue newValue(long ptr, boolean value); |
152 | 152 |
153 private final static native JsValue newValue(long ptr, String value); | 153 private final static native JsValue newValue(long ptr, String value); |
154 | 154 |
155 private final static native void dtor(long ptr); | 155 private final static native void dtor(long ptr); |
156 } | 156 } |
OLD | NEW |