• Tim Volodine's avatar
    [WebLayer] Implement Safe Browsing opt-in/opt-out API · bb18129f
    Tim Volodine authored
    Implement WebLayer API and the corresponding internal Safe Browsing
    bits to make Safe Browsing user opt-in/opt-out possible.
    
    Using this API the embedder can disable/enable the Safe Browsing
    functionality (which checks whether the loaded URLs and resources
    are safe) and obtain its current state. This can be done using
    two methods introduced in this patch which are defined on the
    WebLayer's Profile class:
     - setBooleanSetting(SettingType, boolean)
     - getBooleanSetting(SettingType)
    
    For example, to opt-out of Safe Browsing the embedder can call
    getProfile().setBooleanSetting(SettingType.BASIC_SAFE_BROWSING_ENABLED,
    false) on its browser instance.
    
    Safe Browsing in weblayer is enabled by default, so the current
    semantics is that this is an opt-out option. When toggling the state
    (e.g. opting out) the settings take effect on next load. The setting
    applies to both the browser and renderer initiated loads.
    
    In this patch:
    - Implement internal bits to disable/enable Safe Browsing checks.
    - Make sure to apply the setting via Profile for both browser and
      renderer initiated loads.
    - Implement getter/setter WebLayer API for the embedder to set user
      opt-in/opt-out via Profile.
    - Add SettingType interfaces (with the BASIC_SAFE_BROWSING_ENABLED
      setting) and the corresponding {Get,Set}BooleanSetting() methods.
    - Add the necessary plumbing to the aidl and jni parts of the
      profile classes.
    
    BUG=1083376
    
    
    Change-Id: I3e3b9e314404d262bef57da26e070909feefb095
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225756
    Commit-Queue: Tim Volodine <timvolodine@chromium.org>
    Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#776360}
    bb18129f
safe_browsing_service.h 3.6 KB