• Dominick Ng's avatar
    Call AppBannerManager::OnInstall in BookmarkAppHelper's finishing callback. · 74ac297f
    Dominick Ng authored
    On desktop platforms, calling AppBannerManager::OnInstall in
    BookmarkAppHelper::FinishInstallation resulted in a bug where the userChoice
    promise on beforeinstalleventprompt was not resolved. This is because
    OnInstall() clears Mojo bindings, wiping out the connection between
    AppBannerManager and the beforeinstallpromptevent in the renderer.
    
    This CL moves the call to AppBannerManager::OnInstall from
    BookmarkAppHelper::FinishInstallation to BookmarkAppHelper::callback_. For
    installations from app banners on desktop, this is
    AppBannerManagerDesktop::DidFinishCreatingBookmarkApp; for installations
    from the menu, it is extensions::TabHelper::FinishCreateBookmarkApp. This
    means that for banners, OnInstall can be called after resolving the
    userChoice promise, fixing the bug.
    
    Tests are refactored and a new AppBannerManagerDesktopBrowserTest is
    introduced to test the events are fired as expected after installation.
    
    BUG=890848
    
    Change-Id: I26a122e261ad1104af69443d9230e5458e271d24
    Reviewed-on: https://chromium-review.googlesource.com/c/1256392
    Commit-Queue: Dominick Ng <dominickn@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#596544}
    74ac297f
app_banner_manager_desktop_browsertest.cc 5.66 KB