• dpapad's avatar
    WebUIDataSource: Add ability to query whether a URL is handled by a request filter. · 28dccc44
    dpapad authored
    Before this CL
    WebUIDataSource::SetRequestFilter() accepted a single callback function as a parameter.
    That callback was responsible for
     - communicating via a boolean whether a given URL will be handled.
     - producing the response (bytes) for this request.
    
    This is inflexible, because there are cases where we need to know whether a URL
    will be handled by the request filter, without triggering the request yet. This is in
    preparation of simplifying the mechanism that WebUIDataSourceImpl uses to determine
    when a WebUI resource is gzipped.
    
    After this CL:
    WebUIDataSource::SetRequestFilter() accepts two callback functions.
     - |should_handle_request_callback| simply returns a boolean, indicating whether the
       request will be handled by the request filter, without handling the request.
     - |handle_request_callback| handles the request, without returning any boolean.
    
    TBR=jam@chromium.org
    
    Bug: 738243
    Change-Id: I915b87801908885bcbf05e785bbacf8ad140c481
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1535164
    Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
    Reviewed-by: default avatarcalamity <calamity@chromium.org>
    Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#649289}
    28dccc44
tracing_ui.cc 11.8 KB