Class CombinedSiteKeyExtractor

java.lang.Object
org.adblockplus.libadblockplus.android.webview.CombinedSiteKeyExtractor
All Implemented Interfaces:
SiteKeyExtractor

public class CombinedSiteKeyExtractor
extends java.lang.Object
implements SiteKeyExtractor
Decides what extractor has to be used by analyzing the data that AdblockWebView has. In particular, it reads the WebResourceRequest.isForMainFrame() property in order to understand, if we need to fire fallback extractor
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected CombinedSiteKeyExtractor​(AdblockWebView webView)  
  • Method Summary

    Modifier and Type Method Description
    android.webkit.WebResourceResponse extract​(android.webkit.WebResourceRequest frameRequest)
    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
    void setEnabled​(boolean enabled)  
    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
    void startNewPage()
    Notifies about starting of a new page
    boolean waitForSitekeyCheck​(java.lang.String url, boolean isMainFrame)
    Blocks the calling thread while checking the sitekey

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CombinedSiteKeyExtractor

      protected CombinedSiteKeyExtractor​(AdblockWebView webView)
  • Method Details

    • extract

      public android.webkit.WebResourceResponse extract​(android.webkit.WebResourceRequest frameRequest)
      Description copied from interface: SiteKeyExtractor
      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
      Specified by:
      extract in interface SiteKeyExtractor
      Parameters:
      frameRequest - 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
    • setSiteKeysConfiguration

      public void setSiteKeysConfiguration​(org.adblockplus.libadblockplus.sitekey.SiteKeysConfiguration siteKeysConfiguration)
      Description copied from interface: SiteKeyExtractor
      This method is called by the AdblockWebView during AdblockWebView.setSiteKeysConfiguration(SiteKeysConfiguration) You can later use siteKeysConfiguration in order to verify the sitekey
      Specified by:
      setSiteKeysConfiguration in interface SiteKeyExtractor
      Parameters:
      siteKeysConfiguration - the configuration to set
    • startNewPage

      public void startNewPage()
      Description copied from interface: SiteKeyExtractor
      Notifies about starting of a new page
      Specified by:
      startNewPage in interface SiteKeyExtractor
    • waitForSitekeyCheck

      public boolean waitForSitekeyCheck​(java.lang.String url, boolean isMainFrame)
      Description copied from interface: SiteKeyExtractor
      Blocks the calling thread while checking the sitekey

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

      Specified by:
      waitForSitekeyCheck in interface 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
    • setEnabled

      public void setEnabled​(boolean enabled)
      Specified by:
      setEnabled in interface SiteKeyExtractor