Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/org/adblockplus/android/ABPEngine.java

Issue 29331923: Issue 3364 - Implement JNI bindings for IsDocument/ElemhideWhitelisted (Closed)
Left Patch Set: Typos and unrelated changes. Created Dec. 4, 2015, 3:18 p.m.
Right Patch Set: Typo Created Dec. 4, 2015, 5:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « jni/JniFilterEngine.cpp ('k') | src/org/adblockplus/android/AdblockPlus.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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[] referrer ChainArray) 294 public boolean isDocumentWhitelisted(final String url, final String[] referrer ChainArray)
Felix Dahlke 2015/12/04 15:43:20 It's a bit unfortunate that this was called "refer
René Jeschke 2015/12/04 15:55:59 Done. Remark: "matches above" uses also "referrer
Felix Dahlke 2015/12/04 16:37:36 I don't get the impression you read the part where
René Jeschke 2015/12/04 16:54:47 Frell ... reverted :D
295 { 295 {
296 return this.filterEngine.isDocumentWhitelisted(url, referrerChainArray); 296 return this.filterEngine.isDocumentWhitelisted(url, referrerChainArray);
297 } 297 }
298 298
299 public boolean isElemhideWhitelisted(final String url, final String[] referrer ChainArray) 299 public boolean isElemhideWhitelisted(final String url, final String[] referrer ChainArray)
300 { 300 {
301 return this.filterEngine.isElemhideWhitelisted(url, referrerChainArray); 301 return this.filterEngine.isElemhideWhitelisted(url, referrerChainArray);
302 } 302 }
303 303
304 public List<String> getElementHidingSelectors(final String url, final String[] referrerChainArray) 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
Felix Dahlke 2015/12/04 15:43:20 This deserves a comment. Until now this was just a
René Jeschke 2015/12/04 15:55:59 Nope, we don't need an issue for that. 'elemhideEn
Felix Dahlke 2015/12/04 16:37:36 Sorry, went for the wrong line here, I meant the i
René Jeschke 2015/12/04 16:54:47 Added some comments here and there.
Felix Dahlke 2015/12/04 17:03:37 Nice, but that's still not what I meant :D I meant
307 || this.isDocumentWhitelisted(url, referrerChainArray) 321 || this.isDocumentWhitelisted(url, referrerChainArray)
308 || this.isElemhideWhitelisted(url, referrerChainArray)) 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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld