• Asanka Herath's avatar
    [downloads] Move platform specific code out of DownloadTargetDeterminer. · 8588407d
    Asanka Herath authored
    This CL cleans up the download target determination logic so that:
    
    *  DownloadTargetDeterminer provides a reason for requesting user
       confirmation for a download path.
    
       The caller can thus use platform specific logic to handle the
       confirmation request. Chromium on Android doesn't always prompt the
       user for a download location, and hence needs to know *why* a
       confirmation is requested in order to decide how to proceed.
    
    *  DownloadTargetDeterminer allows the caller to return a finer grained
       result than a boolean following a confirmation request.
    
       Just knowing whether the user confirmed or rejected is insufficient.
       On Android, for example, there are cases where the platform specific
       code will automatically accept a confirmation request raised by the
       DownloadTargetDeterminer. In such cases, it is important to note
       whether the result indicates explicit user consent or not, which is a
       signal used elsewhere for determining download security.
    
    *  DownloadPathReservationTracker provides a detailed result after
       completing target determination.
    
       The extra detail allows DownloadTargetDeterminer to indicate *why*
       the target determination failed rather than just the fact that it
       failed. This result can then be translated to an interrupt reason.
    
    Consequently, the download target conflict resolution logic can now be
    moved entirely into ChromeDownloadManagerDelegate. Previously the logic
    was split between DownloadTargetDeterminer,
    DownloadPathReservationTracker, and ChromeDownloadManagerDelegate on
    Android.
    
    BUG=334474
    
    Change-Id: Id3e40bcb4653f259dab1ae96645c230a2a45e06c
    Reviewed-on: https://chromium-review.googlesource.com/465566Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
    Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
    Commit-Queue: Asanka Herath <asanka@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#464084}
    8588407d
download_confirmation_result.h 1.03 KB