• Tim Volodine's avatar
    [WebLayer] Implement safebrowsing for renderer initiated url loads. · 2bb45c61
    Tim Volodine authored
    Make sure to add a renderer-side safebrowsing throttle in order
    to check renderer initiated url loads using the safebrowsing API.
    This also ensures that resource requests for e.g. .js and .svg
    files are also checked. This approach matches the behavior in
    WebView and Chrome. Due to the addition of methods the original
    safebrowsing initialization sequence is slightly changed (see
    below for details). Additionally the ResourceContext destruction
    has to happen on the IO thread (see below for details).
    
    In particular in this patch:
    - Add and implement ExposeInterfacesToRenderer method to make
      sure renderer can execute safebrowsing calls.
    - Move safebrowsing_service initialization to the
      ExposeInterfacesToRenderer() method because it is executed
      before CreateURLLoaderThrottles.
    - Implement UrlLoaderThrottleProvider in weblayer/renderer/
      which amongst other things adds the
      safe_browsing::RendererURLLoaderThrottle.
    - Implement RenderThreadStarted() and
      CreateURLLoaderThrottleProvider() methods for
      ContentRendererClient.
    - Update build and deps files accordingly.
    - Also make sure to destroy ResourceContext on the IO thread
      (otherwise profile destruction sequence can result in a
      DCHECK, see crbug.com/1029317).
    
    BUG=1015418,1028659,1029317
    
    Change-Id: I67482a450d1974a8b14cb07f4fbedd14e4983e7e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937173
    Commit-Queue: Tim Volodine <timvolodine@chromium.org>
    Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
    Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#720726}
    2bb45c61
url_loader_throttle_provider.h 1.96 KB