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:
@ -220,6 +220,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool HasView() override;
|
||||
bool IsReadyToBeClosed() override;
|
||||
void SetFocus(bool focus) override;
|
||||
int GetOpenerIdentifier() override;
|
||||
void RunFileDialog(FileDialogMode mode,
|
||||
const CefString& title,
|
||||
const CefString& default_file_path,
|
||||
@ -418,6 +419,10 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Returns true if this browser is currently visible.
|
||||
virtual bool IsVisible() const;
|
||||
|
||||
// Returns the next popup ID for use with OnBeforePopup. Must be called on
|
||||
// the UI thread.
|
||||
int GetNextPopupId();
|
||||
|
||||
protected:
|
||||
bool EnsureDevToolsProtocolManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
@ -439,6 +444,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
const bool is_views_hosted_;
|
||||
int opener_id_ = 0;
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
CefBrowserContentsDelegate contents_delegate_;
|
||||
@ -473,6 +479,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
|
||||
std::unique_ptr<CefMediaStreamRegistrar> media_stream_registrar_;
|
||||
|
||||
int next_popup_id_ = 1;
|
||||
|
||||
private:
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserHostBase);
|
||||
};
|
||||
|
Reference in New Issue
Block a user