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

Side by Side Diff: src/org/adblockplus/android/AdblockPlus.java

Issue 29331923: Issue 3364 - Implement JNI bindings for IsDocument/ElemhideWhitelisted (Closed)
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:
View unified diff | Download patch
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 editor.commit(); 262 editor.commit();
263 } 263 }
264 264
265 public boolean isNotifiedAboutAcceptableAds() 265 public boolean isNotifiedAboutAcceptableAds()
266 { 266 {
267 final SharedPreferences preferences = PreferenceManager.getDefaultSharedPref erences(this); 267 final SharedPreferences preferences = PreferenceManager.getDefaultSharedPref erences(this);
268 return preferences.getBoolean("notified_about_acceptable_ads", false); 268 return preferences.getBoolean("notified_about_acceptable_ads", false);
269 } 269 }
270 270
271 /** 271 /**
272 * Returns ElemHide selectors for domain. 272 * Returns ElemHide selectors for the supplied URL.
273 * 273 *
274 * @param domain The domain 274 * @param url The URL
275 * @return A list of CSS selectors 275 * @return A list of CSS selectors
276 */ 276 */
277 public String[] getSelectorsForDomain(final String domain) 277 public String[] getSelectorsForDomain(final String url, String referrer)
278 { 278 {
279 /* We need to ignore element hiding rules here to work around two bugs: 279 if (this.abpEngine.isElemhideEnabled() && this.filteringEnabled)
280 * 1. CSS is being injected even when there's an exception rule with $elemhi de 280 {
281 * 2. The injected CSS causes blank pages in Chrome for Android 281 if (referrer != null)
282 * 282 {
283 * Starting with 1.1.2, we ignored element hiding rules after download anywa y, to keep the 283 this.referrerMapping.add(url, referrer);
284 * memory usage down. Doing this with libadblockplus is trickier, but would be the clean 284 }
285 * solution. */ 285 final List<String> referrerChain = this.referrerMapping.buildReferrerChain (referrer);
286 return null; 286 final String[] referrerChainArray = referrerChain.toArray(new String[refer rerChain.size()]);
287 /* 287 final List<String> selectors = this.abpEngine.getElementHidingSelectors(ur l, referrerChainArray);
288 if (!filteringEnabled) 288 // We're returning 'null' when no selectors are available to be consistent
289 // with the previous implementation
290 return selectors.isEmpty() ? null : selectors.toArray(new String[selectors .size()]);
291 }
292 else
293 {
294 /*
295 * This case is still the default for Adblock Plus for Android, as we did not yet
296 * re-enable element hiding but only enhanced/fixed the current implementa tion.
297 * See: https://issues.adblockplus.org/ticket/3364
298 */
299 /* We need to ignore element hiding rules here to work around two bugs:
300 * 1. CSS is being injected even when there's an exception rule with $elem hide
301 * 2. The injected CSS causes blank pages in Chrome for Android
302 *
303 * Starting with 1.1.2, we ignored element hiding rules after download any way, to keep the
304 * memory usage down. Doing this with libadblockplus is trickier, but woul d be the clean
305 * solution. */
289 return null; 306 return null;
290 307 }
291 return abpEngine.getSelectorsForDomain(domain);
292 */
293 } 308 }
294 309
295 /** 310 /**
296 * Checks if filters match request parameters. 311 * Checks if filters match request parameters.
297 * 312 *
298 * @param url 313 * @param url
299 * Request URL 314 * Request URL
300 * @param query 315 * @param query
301 * Request query string 316 * Request query string
302 * @param referrer 317 * @param referrer
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 449 }
435 catch (final IOException e) 450 catch (final IOException e)
436 { 451 {
437 Log.e(TAG, e.getMessage(), e); 452 Log.e(TAG, e.getMessage(), e);
438 } 453 }
439 454
440 // Set crash handler 455 // Set crash handler
441 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); 456 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this));
442 } 457 }
443 } 458 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/android/ABPEngine.java ('k') | src/org/adblockplus/android/AndroidWebRequest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld