Commit 467f96b5 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Allow dialogs over the bottom sheet with custom scrim lifecycle

This patch allows dialogs to show above the bottom sheet if the
content is using a custom scrim lifecycle. This implies that the user
is allowed to interact with the web page while the sheet is open.

Bug: b/143869922
Change-Id: Ie2836b6f6f650df6f6061c0f67b49eede3de57e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1897858
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712296}
parent 1f56cc87
......@@ -161,6 +161,7 @@ import org.chromium.chrome.browser.vr.VrModuleProvider;
import org.chromium.chrome.browser.webapps.addtohomescreen.AddToHomescreenManager;
import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController;
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver;
import org.chromium.components.bookmarks.BookmarkId;
......@@ -1499,6 +1500,11 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
@Override
public void onSheetOpened(int reason) {
BottomSheetContent content = mBottomSheetController.getCurrentSheetContent();
// Content with a custom scrim lifecycle should not obscure the tab. The feature
// is responsible for adding itself to the list of obscuring views when applicable.
if (content != null && content.hasCustomScrimLifecycle()) return;
addViewObscuringAllTabs(mBottomSheet);
assert mAppModalToken == TokenHolder.INVALID_TOKEN;
......@@ -1513,6 +1519,12 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
@Override
public void onSheetClosed(int reason) {
// This can happen if the sheet has a custom lifecycle.
if (mAppModalToken == TokenHolder.INVALID_TOKEN
&& mTabModalToken == TokenHolder.INVALID_TOKEN) {
return;
}
removeViewObscuringAllTabs(mBottomSheet);
if (getModalDialogManager() != null) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment