• Giovanni Ortuño Urquidi's avatar
    web-ui: Introduce ChromeUntrustedWebUIControllerFactory · 019a2364
    Giovanni Ortuño Urquidi authored
    Currently WebUI properties, e.g. CSPs, requesting schemes, host, mojo,
    etc. are stored in WebUIControllers themselves. The lifetime of a
    WebUIController is bound to the frame, which makes it hard to use for
    some use cases. A non-dynamically allocated class where clients could
    query a WebUIs properties would be easier to use and audit.
    
    Introduces a new WebUIConfig class that stores properties of WebUIs. For
    now the two properties are 1. the WebUI's host and 2. if the WebUI
    is enabled. In the future this class could include information like
    CSPs, if we should enable Mojo, if we should enable chrome.send(), if
    we should allow network requests, URLDataSource, etc.
    
    For now all WebUIConfigs are owned by
    ChromeUntrustedWebUIControllerFactory but that could be moved somewhere
    else so that anyone could retrieve a WebUIConfig and check its
    properties.
    
    ChromeUntrustedWebUIControllerFactory holds a map of hosts to
    WebUIConfigs and implements WebUIControllerFactory methods by querying
    the appropriate config for its properties.
    
    Bug: 1080384
    
    Change-Id: Ieebb0ded877f57d00d6f47aa5b9304cd250b1bf1
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315572
    Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
    Reviewed-by: default avatardpapad <dpapad@chromium.org>
    Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Reviewed-by: default avatarJiewei Qian  <qjw@chromium.org>
    Reviewed-by: default avatarcalamity <calamity@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#836974}
    019a2364
untrusted_web_ui_controller_factory.h 1.94 KB