Interface SiteKeyExtractor
- All Known Implementing Classes:
BaseSiteKeyExtractor,CombinedSiteKeyExtractor,HttpHeaderSiteKeyExtractor
public interface SiteKeyExtractor
Extracts a Site Key from an
AdblockWebView's internals and verifies the Site Key
What is expected from this class:
- Extract the Site Key from all available resources from
AdblockWebView - Use
SiteKeyVerifierto verify it
SiteKeyVerifier is set to
`siteKeysConfiguration` property
AdblockWebView accepts the extractor
by calling AdblockWebView.setSiteKeyExtractor(SiteKeyExtractor)
For example, custom HTTP request can be made and resulting HTTP headers can be used to
extract the Site Key from the header
Or Site Key might be extracted from html root tag by injecting
javascript into AdblockWebView and using JS handler to get the key back to WebView- See Also:
- Site Key
-
Method Summary
Modifier and Type Method Description android.webkit.WebResourceResponseextract(android.webkit.WebResourceRequest request)This method is called by theAdblockWebViewduringWebViewClient.shouldInterceptRequest(WebView, WebResourceRequest)This method must perform custom HTTP request or return one of states fromAdblockWebView.WebResponseResultvoidsetEnabled(boolean enabled)voidsetSiteKeysConfiguration(org.adblockplus.libadblockplus.sitekey.SiteKeysConfiguration siteKeysConfiguration)This method is called by theAdblockWebViewduringAdblockWebView.setSiteKeysConfiguration(SiteKeysConfiguration)You can later use siteKeysConfiguration in order to verify the sitekeyvoidstartNewPage()Notifies about starting of a new pagebooleanwaitForSitekeyCheck(java.lang.String url, boolean isMainFrame)Blocks the calling thread while checking the sitekey
-
Method Details
-
extract
android.webkit.WebResourceResponse extract(android.webkit.WebResourceRequest request)This method is called by theAdblockWebViewduringWebViewClient.shouldInterceptRequest(WebView, WebResourceRequest)This method must perform custom HTTP request or return one of states fromAdblockWebView.WebResponseResult- Parameters:
request- a request that might be used for understanding additional options (e.g. is the request intended for the main frame)- Returns:
- a response that will be passed to
-
startNewPage
void startNewPage()Notifies about starting of a new page -
waitForSitekeyCheck
boolean waitForSitekeyCheck(java.lang.String url, boolean isMainFrame)Blocks the calling thread while checking the sitekeyWill be removed later in a favor of setting internal WebViewClient for every SiteKeyExtractor
- Parameters:
url- a request url which is held back by this callisMainFrame- a boolean indicating whether this is a main or a subframe request- Returns:
- true if had to wait
-
setSiteKeysConfiguration
void setSiteKeysConfiguration(org.adblockplus.libadblockplus.sitekey.SiteKeysConfiguration siteKeysConfiguration)This method is called by theAdblockWebViewduringAdblockWebView.setSiteKeysConfiguration(SiteKeysConfiguration)You can later use siteKeysConfiguration in order to verify the sitekey- Parameters:
siteKeysConfiguration- the configuration to set
-
setEnabled
void setEnabled(boolean enabled)
-