• Hoch Hochkeppel's avatar
    WebApps: Disable "Create shortcut" for error pages · d48c643c
    Hoch Hochkeppel authored
    Updates the check used for gating the availability of various commands
    (CanCreateWebApp) to include a check for the current page being in an
    error state, correctly reflecting the functionality of the code
    associated with this check (CreateWebAppFromCurrentWebContents).
    Currently the only user scenario this changes is the enabled state of
    the "Creates shortcut" command, but this ensures that any other
    commands leveraging the same functionality will be appropriately gated
    as well. Other commands already using this check (such as the command
    for installing a PWA) are already disabled in the error page state due
    to additional restrictions.
    
    Test: Navigate to an invalid page (e.g. "foo.bar") and invoke
    More tools > Create shortcut.  Without this change, nothing will appear
    to happen until navigating to a valid page, at which point the "Create
    shortcut?" dialog will finally appear.  With this change the "Create
    shortcut" menu option will be disabled until you navigate to a valid
    page.
    
    Bug: 1056709
    Change-Id: I9cd15876ca9bc1443b776fe8ea326608cd8ea0ca
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063031
    Commit-Queue: Hoch Hochkeppel <mhochk@microsoft.com>
    Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#745285}
    d48c643c
web_app_browsertest.cc 30.1 KB