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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // (to re-enable in-app ads blocking, proposed on 12.11.2012 Monday meeting) | 284 // (to re-enable in-app ads blocking, proposed on 12.11.2012 Monday meeting) |
285 // (documentUrls contains the referrers on Android) | 285 // (documentUrls contains the referrers on Android) |
286 if (referrerChainArray.length == 0 && (filter.getProperty("text").toString()
).contains("||")) | 286 if (referrerChainArray.length == 0 && (filter.getProperty("text").toString()
).contains("||")) |
287 { | 287 { |
288 return false; | 288 return false; |
289 } | 289 } |
290 | 290 |
291 return filter.getType() != Filter.Type.EXCEPTION; | 291 return filter.getType() != Filter.Type.EXCEPTION; |
292 } | 292 } |
293 | 293 |
294 public boolean isDocumentWhitelisted(final String url, final String[] document
Urls) | 294 public boolean isDocumentWhitelisted(final String url, final String[] referrer
ChainArray) |
295 { | 295 { |
296 return this.filterEngine.isDocumentWhitelisted(url, documentUrls); | 296 return this.filterEngine.isDocumentWhitelisted(url, referrerChainArray); |
297 } | 297 } |
298 | 298 |
299 public boolean isElemhideWhitelisted(final String url, final String[] document
Urls) | 299 public boolean isElemhideWhitelisted(final String url, final String[] referrer
ChainArray) |
300 { | 300 { |
301 return this.filterEngine.isElemhideWhitelisted(url, documentUrls); | 301 return this.filterEngine.isElemhideWhitelisted(url, referrerChainArray); |
302 } | 302 } |
303 | 303 |
304 public List<String> getElementHidingSelectors(final String url, final String[]
documentUrls) | 304 public List<String> getElementHidingSelectors(final String url, final String[]
referrerChainArray) |
305 { | 305 { |
| 306 /* |
| 307 * Issue 3364 (https://issues.adblockplus.org/ticket/3364) introduced the |
| 308 * feature to re-enabled element hiding. |
| 309 * |
| 310 * Nothing changes for Adblock Plus for Android, as `this.elemhideEnabled` |
| 311 * is `false`, which results in an empty list being returned and converted |
| 312 * into a `(String[])null` in AdblockPlus.java, which is the only place |
| 313 * this function here is called from Adblock Plus for Android. |
| 314 * |
| 315 * If element hiding is enabled, then this function now first checks for |
| 316 * possible whitelisting of either the document or element hiding for |
| 317 * the given URL and returns an empty list if so. This is needed to |
| 318 * ensure correct functioning of e.g. acceptable ads. |
| 319 */ |
306 if (!this.elemhideEnabled | 320 if (!this.elemhideEnabled |
307 || this.isDocumentWhitelisted(url, documentUrls) | 321 || this.isDocumentWhitelisted(url, referrerChainArray) |
308 || this.isElemhideWhitelisted(url, documentUrls)) | 322 || this.isElemhideWhitelisted(url, referrerChainArray)) |
309 { | 323 { |
310 return new ArrayList<String>(); | 324 return new ArrayList<String>(); |
311 } | 325 } |
312 return this.filterEngine.getElementHidingSelectors(url); | 326 return this.filterEngine.getElementHidingSelectors(url); |
313 } | 327 } |
314 | 328 |
315 public void checkForUpdates() | 329 public void checkForUpdates() |
316 { | 330 { |
317 this.filterEngine.forceUpdateCheck(this.updateCheckDoneCallback); | 331 this.filterEngine.forceUpdateCheck(this.updateCheckDoneCallback); |
318 } | 332 } |
319 | 333 |
320 public void updateSubscriptionStatus(final String url) | 334 public void updateSubscriptionStatus(final String url) |
321 { | 335 { |
322 final Subscription sub = this.filterEngine.getSubscription(url); | 336 final Subscription sub = this.filterEngine.getSubscription(url); |
323 if (sub != null) | 337 if (sub != null) |
324 { | 338 { |
325 Utils.updateSubscriptionStatus(this.context, sub); | 339 Utils.updateSubscriptionStatus(this.context, sub); |
326 } | 340 } |
327 } | 341 } |
328 | 342 |
329 public FilterEngine getFilterEngine() | 343 public FilterEngine getFilterEngine() |
330 { | 344 { |
331 return this.filterEngine; | 345 return this.filterEngine; |
332 } | 346 } |
333 } | 347 } |
LEFT | RIGHT |