[iOS] Fix OverlayPresentationContext::IsShowingOverlayUI()
The previous implementation returned whether or not the active request was set to a non-null value. However, this is not always correct because there is a brief period between the overlay UI's dismissal and the resetting of OverlayPresentationContextImpl state during which the request is non-null, but its overlay UI is dismissed. This caused breakage for queued OverlayRequests, as OverlayPresenterImpl only attempted to present UI for a subsequent request if the context returned false from this function. Since the context reported that it was still showing overlay UI, the next request was not presented and the context cleaned its state up by resetting its presentation capabilities to kNone. If the prior request required UIViewController presentation, this resulted in the dismissal of the presentation context view controller. When the OverlayPresenterImpl is notified of the updated kNone presentation capabilities, it then attempted to present the next request. If the next request also required UIViewController presentation, this attempted to re-present the presentation context view controller and this presentation would no- op since the previous view controller was not finished being dismissed. This CL updates IsShowingOverlayUI() to return false if the dismissal callback for the active request has already been executed, which prevents the early return in OverlayPresenterImpl's PresentOverlayForActiveRequest(). As an implementation detail, this CL updates GetRequestUIState() to use const std::map APIs so that it can be called from IsShowingOverlayUI(), which is also const. Bug: none Change-Id: Id3b519f6129838f78d3fdcf0d65436ee4bf74cc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159689Reviewed-by:Chris Lu <thegreenfrog@chromium.org> Commit-Queue: Chris Lu <thegreenfrog@chromium.org> Auto-Submit: Kurt Horimoto <kkhorimoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#761129}
Showing
Please register or sign in to comment