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 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 */ | 126 */ |
127 public static class Builder | 127 public static class Builder |
128 { | 128 { |
129 private Context context; | 129 private Context context; |
130 private Map<String, Integer> urlToResourceIdMap; | 130 private Map<String, Integer> urlToResourceIdMap; |
131 private AndroidWebRequestResourceWrapper.Storage resourceStorage; | 131 private AndroidWebRequestResourceWrapper.Storage resourceStorage; |
132 private AndroidWebRequest androidWebRequest; | 132 private AndroidWebRequest androidWebRequest; |
133 private AppInfo appInfo; | 133 private AppInfo appInfo; |
134 private String basePath; | 134 private String basePath; |
135 private IsAllowedConnectionCallback isAllowedConnectionCallback; | 135 private IsAllowedConnectionCallback isAllowedConnectionCallback; |
136 private Long v8IsolatePtr; | 136 private Long v8IsolatePtr; |
137 | 137 |
138 private AdblockEngine engine; | 138 private AdblockEngine engine; |
139 | 139 |
140 protected Builder(final AppInfo appInfo, final String basePath) | 140 protected Builder(final AppInfo appInfo, final String basePath) |
141 { | 141 { |
142 engine = new AdblockEngine(); | 142 engine = new AdblockEngine(); |
143 engine.elemhideEnabled = true; | 143 engine.elemhideEnabled = true; |
144 | 144 |
145 // we can't create JsEngine and FilterEngine right now as it starts to dow
nload subscriptions | 145 // we can't create JsEngine and FilterEngine right now as it starts to dow
nload subscriptions |
146 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie
d yet | 146 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie
d yet |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 androidWebRequest.updateSubscriptionURLs(engine.filterEngine); | 256 androidWebRequest.updateSubscriptionURLs(engine.filterEngine); |
257 | 257 |
258 return engine; | 258 return engine; |
259 } | 259 } |
260 | 260 |
261 private void createEngines() | 261 private void createEngines() |
262 { | 262 { |
263 engine.logSystem = new AndroidLogSystem(); | 263 engine.logSystem = new AndroidLogSystem(); |
264 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa
th); | 264 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa
th); |
265 engine.platform.setUpJsEngine(appInfo, v8IsolatePtr); | 265 if (v8IsolatePtr != null) |
| 266 { |
| 267 engine.platform.setUpJsEngine(appInfo, v8IsolatePtr); |
| 268 } |
| 269 else |
| 270 { |
| 271 engine.platform.setUpJsEngine(appInfo); |
| 272 } |
266 engine.platform.setUpFilterEngine(isAllowedConnectionCallback); | 273 engine.platform.setUpFilterEngine(isAllowedConnectionCallback); |
267 engine.filterEngine = engine.platform.getFilterEngine(); | 274 engine.filterEngine = engine.platform.getFilterEngine(); |
268 } | 275 } |
269 } | 276 } |
270 | 277 |
271 public static Builder builder(AppInfo appInfo, String basePath) | 278 public static Builder builder(AppInfo appInfo, String basePath) |
272 { | 279 { |
273 return new Builder(appInfo, basePath); | 280 return new Builder(appInfo, basePath); |
274 } | 281 } |
275 | 282 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 public void setWhitelistedDomains(List<String> domains) | 624 public void setWhitelistedDomains(List<String> domains) |
618 { | 625 { |
619 this.whitelistedDomains = domains; | 626 this.whitelistedDomains = domains; |
620 } | 627 } |
621 | 628 |
622 public List<String> getWhitelistedDomains() | 629 public List<String> getWhitelistedDomains() |
623 { | 630 { |
624 return whitelistedDomains; | 631 return whitelistedDomains; |
625 } | 632 } |
626 } | 633 } |
LEFT | RIGHT |