Chromium Embedded Framework (CEF)  121.0.1+g7a4b55f+chromium-121.0.6167.16
CefJSDialogHandler Class Reference

Implement this interface to handle events related to JavaScript dialogs. More...

#include "include/cef_jsdialog_handler.h"

Inheritance diagram for CefJSDialogHandler:
CefBaseRefCounted

Public Types

typedef cef_jsdialog_type_t JSDialogType
 

Public Member Functions

virtual bool OnJSDialog (CefRefPtr< CefBrowser > browser, const CefString &origin_url, JSDialogType dialog_type, const CefString &message_text, const CefString &default_prompt_text, CefRefPtr< CefJSDialogCallback > callback, bool &suppress_message)
 Called to run a JavaScript dialog. More...
 
virtual bool OnBeforeUnloadDialog (CefRefPtr< CefBrowser > browser, const CefString &message_text, bool is_reload, CefRefPtr< CefJSDialogCallback > callback)
 Called to run a dialog asking the user if they want to leave a page. More...
 
virtual void OnResetDialogState (CefRefPtr< CefBrowser > browser)
 Called to cancel any pending dialogs and reset any saved dialog state. More...
 
virtual void OnDialogClosed (CefRefPtr< CefBrowser > browser)
 Called when the dialog is closed. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Implement this interface to handle events related to JavaScript dialogs.

The methods of this class will be called on the UI thread.

Member Typedef Documentation

◆ JSDialogType

Member Function Documentation

◆ OnBeforeUnloadDialog()

virtual bool CefJSDialogHandler::OnBeforeUnloadDialog ( CefRefPtr< CefBrowser browser,
const CefString message_text,
bool  is_reload,
CefRefPtr< CefJSDialogCallback callback 
)
inlinevirtual

Called to run a dialog asking the user if they want to leave a page.

Return false to use the default dialog implementation. Return true if the application will use a custom dialog or if the callback has been executed immediately. Custom dialogs may be either modal or modeless. If a custom dialog is used the application must execute |callback| once the custom dialog is dismissed.

◆ OnDialogClosed()

virtual void CefJSDialogHandler::OnDialogClosed ( CefRefPtr< CefBrowser browser)
inlinevirtual

Called when the dialog is closed.

◆ OnJSDialog()

virtual bool CefJSDialogHandler::OnJSDialog ( CefRefPtr< CefBrowser browser,
const CefString origin_url,
JSDialogType  dialog_type,
const CefString message_text,
const CefString default_prompt_text,
CefRefPtr< CefJSDialogCallback callback,
bool &  suppress_message 
)
inlinevirtual

Called to run a JavaScript dialog.

If |origin_url| is non-empty it can be passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure and user-friendly display string. The |default_prompt_text| value will be specified for prompt dialogs only. Set |suppress_message| to true and return false to suppress the message (suppressing messages is preferable to immediately executing the callback as this is used to detect presumably malicious behavior like spamming alert messages in onbeforeunload). Set |suppress_message| to false and return false to use the default implementation (the default implementation will show one modal dialog at a time and suppress any additional dialog requests until the displayed dialog is dismissed). Return true if the application will use a custom dialog or if the callback has been executed immediately. Custom dialogs may be either modal or modeless. If a custom dialog is used the application must execute |callback| once the custom dialog is dismissed.

◆ OnResetDialogState()

virtual void CefJSDialogHandler::OnResetDialogState ( CefRefPtr< CefBrowser browser)
inlinevirtual

Called to cancel any pending dialogs and reset any saved dialog state.

Will be called due to events like page navigation irregardless of whether any dialogs are currently pending.


The documentation for this class was generated from the following file: