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:
  1. Extract the Site Key from all available resources from AdblockWebView
  2. Use SiteKeyVerifier to verify it
An instance of 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 Details

    • extract

      android.webkit.WebResourceResponse extract​(android.webkit.WebResourceRequest request)
      This method is called by the AdblockWebView during WebViewClient.shouldInterceptRequest(WebView, WebResourceRequest) This method must perform custom HTTP request or return one of states from AdblockWebView.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 sitekey

      Will be removed later in a favor of setting internal WebViewClient for every SiteKeyExtractor

      Parameters:
      url - a request url which is held back by this call
      isMainFrame - 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 the AdblockWebView during AdblockWebView.setSiteKeysConfiguration(SiteKeysConfiguration) You can later use siteKeysConfiguration in order to verify the sitekey
      Parameters:
      siteKeysConfiguration - the configuration to set
    • setEnabled

      void setEnabled​(boolean enabled)