mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add notification for aborted popups (fixes #3776)
Pass a new |popup_id| parameter to OnBeforePopup and call a new OnBeforePopupAborted callback if the popup is aborted before OnAfterCreated is called for the popup browser. Add new CefBrowserHost::GetBrowserByIdentifier and GetOpenerIdentifier methods to assist with retrieval of associated browsers. In cefclient, clean up state when a popup is aborted and close any associated popup browsers when the opener browser is closed. This also works when running with `--use-default-popup`.
This commit is contained in:
@ -330,7 +330,7 @@ CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() {
|
||||
}
|
||||
|
||||
CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
return opener_;
|
||||
return opener_window_handle_;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::Find(const CefString& searchText,
|
||||
@ -1414,14 +1414,17 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
|
||||
browser_info,
|
||||
request_context),
|
||||
content::WebContentsObserver(web_contents),
|
||||
opener_(kNullWindowHandle),
|
||||
is_windowless_(platform_delegate_->IsWindowless()) {
|
||||
contents_delegate_.ObserveWebContents(web_contents);
|
||||
|
||||
if (opener.get() && !is_views_hosted_) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
// popup browsers.
|
||||
opener_ = opener->GetWindowHandle();
|
||||
if (opener.get()) {
|
||||
opener_id_ = opener->GetIdentifier();
|
||||
|
||||
if (!is_views_hosted_) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
// popup browsers.
|
||||
opener_window_handle_ = opener->GetWindowHandle();
|
||||
}
|
||||
}
|
||||
|
||||
// Associate the platform delegate with this browser.
|
||||
|
Reference in New Issue
Block a user