Configure Solution Settings
Available APIs
The ad-filtering system offers multiple entry points for controlling behavior:
-
C++ class
FilteringConfiguration -
Java class
org.chromium.components.adblock.FilteringConfiguration -
Browser Extension API in
chrome/common/extensions/api/eyeo_filtering_private.idl
API Requirements
|
Language |
Platform Requirements |
|---|---|
|
Java |
Android OS; requires BrowserContextHandle instance |
|
JavaScript |
Desktop OS (Windows, Linux, macOS); extension ID SHA1 hash must be allowlisted in |
|
C++ |
Any platform; requires BrowserContext instance; API changes frequently |
Capabilities
Toggle Ad Filtering
Call setEnabled with a boolean value to toggle filtering, or isEnabled to check status.
Java Example:
FilteringConfiguration adblockConfiguration =
FilteringConfiguration.createConfiguration("adblock", browserContextHandle);
adblockConfiguration.isEnabled(); // true
adblockConfiguration.setEnabled(false);
adblockConfiguration.isEnabled(); // false
JavaScript Example:
chrome.eyeoFilteringPrivate.isEnabled("adblock"); // true
chrome.eyeoFilteringPrivate.setEnabled("adblock", false);
C++ Example:
auto configuration =
subscription_service->GetFilteringConfiguration("adblock");
configuration->isEnabled(); // true
configuration->SetEnabled(false);
Toggle Acceptable Ads
Add or remove the Acceptable Ads filter list using its URL:
-
Java: Use
getFilterLists().contains(),removeFilterList(), andFilteringConfiguration.getAcceptableAdsUrl() -
JavaScript: Chain promises with
getAcceptableAdsUrl()andremoveFilterList() -
C++: Use
IsFilterListPresent(AcceptableAdsUrl())andRemoveFilterList()
Add/Remove Filter Lists
Filter lists are identified by download URLs. Use:
-
addFilterList()to install -
removeFilterList()to uninstall -
getFilterLists()to retrieve installed subscriptions
Enable/Disable Filtering on Specific Domains
Use addAllowedDomain() to exempt a domain and removeAllowedDomain() to resume filtering.
Note: Pass a domain (
example.com) as an argument, not a URL.
Add/Remove Custom Filters
Manage individual filters with addCustomFilter(), removeCustomFilter(), and getCustomFilters().
Example filter format: example_domain##.example_selector
Subscribe to Resource Events
Listen for blocking/allowing events to implement UI counters. Unsubscribe if unused to avoid performance penalties.
-
Java: Implement
ResourceClassificationNotifier.ResourceFilteringObserverwith callback methods -
JavaScript: Use
chrome.eyeoFilteringPrivate.onRequestAllowed.addListener()and similar listeners -
C++: Extend
adblock::ResourceClassificationRunner::Observerand implement event methods