| Index: src/org/adblockplus/android/ABPEngine.java |
| diff --git a/src/org/adblockplus/android/ABPEngine.java b/src/org/adblockplus/android/ABPEngine.java |
| index 418185e0f0fcde90f0fde593af69e92c206fec8e..b99eccca8a0471183f0e550a9a8f5226e135bfc2 100644 |
| --- a/src/org/adblockplus/android/ABPEngine.java |
| +++ b/src/org/adblockplus/android/ABPEngine.java |
| @@ -17,6 +17,7 @@ |
| package org.adblockplus.android; |
| +import java.util.ArrayList; |
| import java.util.List; |
| import java.util.Locale; |
| @@ -63,10 +64,12 @@ public final class ABPEngine |
| private volatile UpdateCheckDoneCallback updateCheckDoneCallback; |
| private volatile FilterChangeCallback filterChangeCallback; |
| private volatile ShowNotificationCallback showNotificationCallback; |
| + private final boolean elemhideEnabled; |
| - private ABPEngine(final Context context) |
| + private ABPEngine(final Context context, final boolean enableElemhide) |
| { |
| this.context = context; |
| + this.elemhideEnabled = enableElemhide; |
| } |
| public static AppInfo generateAppInfo(final Context context) |
| @@ -97,7 +100,12 @@ public final class ABPEngine |
| public static ABPEngine create(final Context context, final AppInfo appInfo, final String basePath) |
| { |
| - final ABPEngine engine = new ABPEngine(context); |
| + return create(context, appInfo, basePath, false); |
| + } |
| + |
| + public static ABPEngine create(final Context context, final AppInfo appInfo, final String basePath, boolean enableElemhide) |
| + { |
| + final ABPEngine engine = new ABPEngine(context, enableElemhide); |
| engine.jsEngine = new JsEngine(appInfo); |
| engine.jsEngine.setDefaultFileSystem(basePath); |
| @@ -105,7 +113,7 @@ public final class ABPEngine |
| engine.logSystem = new AndroidLogSystem(); |
| engine.jsEngine.setLogSystem(engine.logSystem); |
| - engine.webRequest = new AndroidWebRequest(); |
| + engine.webRequest = new AndroidWebRequest(enableElemhide); |
| engine.jsEngine.setWebRequest(engine.webRequest); |
| engine.filterEngine = new FilterEngine(engine.jsEngine); |
| @@ -182,6 +190,11 @@ public final class ABPEngine |
| return this.filterEngine.isFirstRun(); |
| } |
| + public boolean isElemhideEnabled() |
| + { |
| + return this.elemhideEnabled; |
| + } |
| + |
| private static org.adblockplus.android.Subscription convertJsSubscription(final Subscription jsSubscription) |
| { |
| final org.adblockplus.android.Subscription subscription = new org.adblockplus.android.Subscription(); |
| @@ -278,6 +291,27 @@ public final class ABPEngine |
| return filter.getType() != Filter.Type.EXCEPTION; |
| } |
| + public boolean isDocumentWhitelisted(final String url, final String[] referrerChainArray) |
|
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
|
| + { |
| + return this.filterEngine.isDocumentWhitelisted(url, referrerChainArray); |
| + } |
| + |
| + public boolean isElemhideWhitelisted(final String url, final String[] referrerChainArray) |
| + { |
| + return this.filterEngine.isElemhideWhitelisted(url, referrerChainArray); |
| + } |
| + |
| + public List<String> getElementHidingSelectors(final String url, final String[] referrerChainArray) |
| + { |
| + 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
|
| + || this.isDocumentWhitelisted(url, referrerChainArray) |
| + || this.isElemhideWhitelisted(url, referrerChainArray)) |
| + { |
| + return new ArrayList<String>(); |
| + } |
| + return this.filterEngine.getElementHidingSelectors(url); |
| + } |
| + |
| public void checkForUpdates() |
| { |
| this.filterEngine.forceUpdateCheck(this.updateCheckDoneCallback); |
| @@ -291,4 +325,9 @@ public final class ABPEngine |
| Utils.updateSubscriptionStatus(this.context, sub); |
| } |
| } |
| + |
| + public FilterEngine getFilterEngine() |
| + { |
| + return this.filterEngine; |
| + } |
| } |