| 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-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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 domain. |
| 273 * | 273 * |
| 274 * @param domain The domain | 274 * @param domain The domain |
| 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 return selectors.toArray(new String[selectors.size()]); |
| 289 } |
| 290 else |
| 291 { |
| 292 /* We need to ignore element hiding rules here to work around two bugs: |
| 293 * 1. CSS is being injected even when there's an exception rule with $elem
hide |
| 294 * 2. The injected CSS causes blank pages in Chrome for Android |
| 295 * |
| 296 * Starting with 1.1.2, we ignored element hiding rules after download any
way, to keep the |
| 297 * memory usage down. Doing this with libadblockplus is trickier, but woul
d be the clean |
| 298 * solution. */ |
| 289 return null; | 299 return null; |
| 290 | 300 } |
| 291 return abpEngine.getSelectorsForDomain(domain); | |
| 292 */ | |
| 293 } | 301 } |
| 294 | 302 |
| 295 /** | 303 /** |
| 296 * Checks if filters match request parameters. | 304 * Checks if filters match request parameters. |
| 297 * | 305 * |
| 298 * @param url | 306 * @param url |
| 299 * Request URL | 307 * Request URL |
| 300 * @param query | 308 * @param query |
| 301 * Request query string | 309 * Request query string |
| 302 * @param referrer | 310 * @param referrer |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 442 } |
| 435 catch (final IOException e) | 443 catch (final IOException e) |
| 436 { | 444 { |
| 437 Log.e(TAG, e.getMessage(), e); | 445 Log.e(TAG, e.getMessage(), e); |
| 438 } | 446 } |
| 439 | 447 |
| 440 // Set crash handler | 448 // Set crash handler |
| 441 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); | 449 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); |
| 442 } | 450 } |
| 443 } | 451 } |
| OLD | NEW |