public final class FilterEngine
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FilterEngine.ContentType |
static class |
FilterEngine.EmulationSelector |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EMPTY_PARENT |
static java.lang.String |
EMPTY_SITEKEY |
protected long |
ptr |
| Modifier and Type | Method and Description |
|---|---|
void |
addFilter(Filter filter) |
void |
addSubscription(Subscription subscription) |
java.util.List<Subscription> |
fetchAvailableSubscriptions() |
java.lang.String |
getAcceptableAdsSubscriptionURL() |
java.lang.String |
getAllowedConnectionType() |
java.util.List<FilterEngine.EmulationSelector> |
getElementHidingEmulationSelectors(java.lang.String domain) |
java.lang.String |
getElementHidingStyleSheet(java.lang.String domain) |
java.lang.String |
getElementHidingStyleSheet(java.lang.String domain,
boolean specificOnly) |
Filter |
getFilter(java.lang.String text) |
java.lang.String |
getHostFromURL(java.lang.String url) |
java.util.List<Filter> |
getListedFilters() |
java.util.List<Subscription> |
getListedSubscriptions() |
long |
getNativePtr()
Get FilterEngine pointer
|
JsValue |
getPref(java.lang.String pref) |
Subscription |
getSubscription(java.lang.String url) |
boolean |
isAcceptableAdsEnabled() |
boolean |
isContentAllowlisted(java.lang.String url,
java.util.Set<FilterEngine.ContentType> contentTypes,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
Checks whether the resource at the supplied URL is allowlisted.
|
boolean |
isDocumentAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
Deprecated.
Use FilterEngine#isContentAllowlisted) with contentType containing
{@link ContentType#DOCUMENT} instead.
|
boolean |
isElemhideAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
Deprecated.
Use FilterEngine#isContentAllowlisted) with contentType containing
{@link ContentType#ELEMHIDE} instead.
|
boolean |
isGenericblockAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
Deprecated.
Use FilterEngine#isContentAllowlisted) with contentType containing
{@link ContentType#GENERICBLOCK} instead.
|
Filter |
matches(java.lang.String url,
java.util.Set<FilterEngine.ContentType> contentTypes,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
Deprecated.
Use FilterEngine#matches) which takes a single parent as a String instead of
{@param documentUrls} and {@param specificOnly} argument.
|
Filter |
matches(java.lang.String url,
java.util.Set<FilterEngine.ContentType> contentTypes,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey,
boolean specificOnly)
Deprecated.
Use FilterEngine#matches) which takes a single parent as a String instead of
{@param documentUrls}.
|
Filter |
matches(java.lang.String url,
java.util.Set<FilterEngine.ContentType> contentTypes,
java.lang.String parent,
java.lang.String siteKey,
boolean specificOnly)
Checks if any active filter matches the supplied URL.
|
void |
removeFilter(Filter filter) |
void |
removeFilterChangeCallback() |
void |
removeSubscription(Subscription subscription) |
void |
setAcceptableAdsEnabled(boolean enabled) |
void |
setAllowedConnectionType(java.lang.String value) |
void |
setFilterChangeCallback(FilterChangeCallback callback) |
void |
setPref(java.lang.String pref,
JsValue value)
Set libadblockplus preference.
|
void |
updateFiltersAsync(java.lang.String subscriptionUrl)
Schedules updating of a subscription corresponding to the passed URL.
|
public static final java.lang.String EMPTY_PARENT
public static final java.lang.String EMPTY_SITEKEY
protected final long ptr
public Filter getFilter(java.lang.String text)
public java.util.List<Filter> getListedFilters()
public Subscription getSubscription(java.lang.String url)
public java.util.List<Subscription> getListedSubscriptions()
public java.util.List<Subscription> fetchAvailableSubscriptions()
public void removeFilterChangeCallback()
public void setFilterChangeCallback(FilterChangeCallback callback)
public java.lang.String getElementHidingStyleSheet(java.lang.String domain)
public java.lang.String getElementHidingStyleSheet(java.lang.String domain,
boolean specificOnly)
public java.util.List<FilterEngine.EmulationSelector> getElementHidingEmulationSelectors(java.lang.String domain)
@Deprecated public Filter matches(java.lang.String url, java.util.Set<FilterEngine.ContentType> contentTypes, java.util.List<java.lang.String> documentUrls, java.lang.String siteKey)
url - url URL to match.contentTypes - Content type mask of the requested resource.documentUrls - Chain of documents requesting the resource, starting
with the current resource's parent frame, ending with the
top-level frame.siteKey - sitekey or null/empty string@Deprecated public Filter matches(java.lang.String url, java.util.Set<FilterEngine.ContentType> contentTypes, java.util.List<java.lang.String> documentUrls, java.lang.String siteKey, boolean specificOnly)
url - url URL to match.contentTypes - Content type mask of the requested resource.documentUrls - Chain of documents requesting the resource, starting
with the current resource's parent frame, ending with the
top-level frame.siteKey - sitekey or null/empty stringspecificOnly - if set to `true` then skips generic filterspublic Filter matches(java.lang.String url, java.util.Set<FilterEngine.ContentType> contentTypes, java.lang.String parent, java.lang.String siteKey, boolean specificOnly)
url - url URL to match.contentTypes - Content type mask of the requested resource.parent - immediate parent of the .siteKey - sitekey or null/empty stringspecificOnly - if set to `true` then skips generic filterspublic boolean isContentAllowlisted(java.lang.String url,
java.util.Set<FilterEngine.ContentType> contentTypes,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
url - URL of the resource.contentTypes - Set of content types for requested resource.documentUrls - Chain of URLs requesting the resourcesiteKey - public key provided by the document, can be empty.@Deprecated
public boolean isGenericblockAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
url - URL to match which is actually first parent of URL for which we
want to check a $genericblock filter.
Value obtained by `IsGenericblockAllowlisted()` is used later
on as a `specificOnly` parameter value for `Matches()` call.documentUrls - Chain of documents requesting the resource, starting
with the current resource's parent frame, ending with the
top-level frame.siteKey - sitekey or null/empty string@Deprecated
public boolean isDocumentAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
url - URLdocumentUrls - Chain of document URLs requesting the document,
starting with the current document's parent frame, ending with
the top-level frame.siteKey - sitekey or null/empty string@Deprecated
public boolean isElemhideAllowlisted(java.lang.String url,
java.util.List<java.lang.String> documentUrls,
java.lang.String siteKey)
url - URLdocumentUrls - Chain of document URLs requesting the document,
starting with the current document's parent frame, ending with
the top-level frame.siteKey - sitekey or null/empty stringpublic JsValue getPref(java.lang.String pref)
public void setPref(java.lang.String pref,
JsValue value)
pref - preference name. See lib/pref.js in libadblockplus for valid namesvalue - preference valuepublic java.lang.String getHostFromURL(java.lang.String url)
public void setAllowedConnectionType(java.lang.String value)
public java.lang.String getAllowedConnectionType()
public void setAcceptableAdsEnabled(boolean enabled)
public boolean isAcceptableAdsEnabled()
public java.lang.String getAcceptableAdsSubscriptionURL()
public void updateFiltersAsync(java.lang.String subscriptionUrl)
subscriptionUrl - may contain query parameters, only the beginning of the string is used
to find a corresponding subscription.public long getNativePtr()
public void addSubscription(Subscription subscription)
public void removeSubscription(Subscription subscription)
public void addFilter(Filter filter)
public void removeFilter(Filter filter)