chrome: Improve positioning of dialogs (fixes #3628)

Dialogs will be excluded from regions near the top of the window
that contain overlays, draggable regions or titlebar.
This commit is contained in:
Marshall Greenblatt
2024-01-11 18:32:08 -05:00
parent 0d50d5a8c6
commit 5af6227a6f
16 changed files with 274 additions and 85 deletions

View File

@ -93,8 +93,15 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForGlobalId(
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForBrowser(
const Browser* browser) {
REQUIRE_CHROME_RUNTIME();
return GetBrowserForContents(
browser->tab_strip_model()->GetActiveWebContents());
// Return the ChromeBrowserHostImpl that is currently active.
// Views-hosted Browsers will contain a single ChromeBrowserHostImpl.
// Otherwise, there will be a ChromeBrowserHostImpl per Tab/WebContents.
// |contents| may be nullptr during Browser initialization or destruction.
auto contents = browser->tab_strip_model()->GetActiveWebContents();
if (!contents) {
return nullptr;
}
return GetBrowserForContents(contents);
}
ChromeBrowserHostImpl::~ChromeBrowserHostImpl() = default;