@@ -17,7 +17,8 @@ class ClientHandler :
1717 public CefKeyboardHandler,
1818 public CefRequestHandler,
1919 public CefLoadHandler,
20- public CefRenderHandler
20+ public CefRenderHandler,
21+ public CefJSDialogHandler
2122{
2223public:
2324 ClientHandler (){}
@@ -89,7 +90,7 @@ class ClientHandler :
8990 // /
9091 /* --cef()--*/
9192 virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler () OVERRIDE {
92- return NULL ;
93+ return this ;
9394 }
9495
9596 // /
@@ -640,6 +641,66 @@ class ClientHandler :
640641 /* --cef()--*/
641642 virtual void OnScrollOffsetChanged (CefRefPtr<CefBrowser> browser) OVERRIDE;
642643
644+ // --------------------------------------------------------------------------
645+ // CefJSDialogHandler
646+ // --------------------------------------------------------------------------
647+ typedef cef_jsdialog_type_t JSDialogType;
648+
649+ // /
650+ // Called to run a JavaScript dialog. The |default_prompt_text| value will be
651+ // specified for prompt dialogs only. Set |suppress_message| to true and
652+ // return false to suppress the message (suppressing messages is preferable
653+ // to immediately executing the callback as this is used to detect presumably
654+ // malicious behavior like spamming alert messages in onbeforeunload). Set
655+ // |suppress_message| to false and return false to use the default
656+ // implementation (the default implementation will show one modal dialog at a
657+ // time and suppress any additional dialog requests until the displayed dialog
658+ // is dismissed). Return true if the application will use a custom dialog or
659+ // if the callback has been executed immediately. Custom dialogs may be either
660+ // modal or modeless. If a custom dialog is used the application must execute
661+ // |callback| once the custom dialog is dismissed.
662+ // /
663+ /* --cef(optional_param=accept_lang,optional_param=message_text,
664+ optional_param=default_prompt_text)--*/
665+ virtual bool OnJSDialog (CefRefPtr<CefBrowser> browser,
666+ const CefString& origin_url,
667+ const CefString& accept_lang,
668+ JSDialogType dialog_type,
669+ const CefString& message_text,
670+ const CefString& default_prompt_text,
671+ CefRefPtr<CefJSDialogCallback> callback,
672+ bool & suppress_message) OVERRIDE;
673+
674+ // /
675+ // Called to run a dialog asking the user if they want to leave a page. Return
676+ // false to use the default dialog implementation. Return true if the
677+ // application will use a custom dialog or if the callback has been executed
678+ // immediately. Custom dialogs may be either modal or modeless. If a custom
679+ // dialog is used the application must execute |callback| once the custom
680+ // dialog is dismissed.
681+ // /
682+ /* --cef(optional_param=message_text)--*/
683+ virtual bool OnBeforeUnloadDialog (CefRefPtr<CefBrowser> browser,
684+ const CefString& message_text,
685+ bool is_reload,
686+ CefRefPtr<CefJSDialogCallback> callback)
687+ OVERRIDE;
688+
689+ // /
690+ // Called to cancel any pending dialogs and reset any saved dialog state. Will
691+ // be called due to events like page navigation irregardless of whether any
692+ // dialogs are currently pending.
693+ // /
694+ /* --cef()--*/
695+ virtual void OnResetDialogState (CefRefPtr<CefBrowser> browser) OVERRIDE;
696+
697+ // /
698+ // Called when the default implementation dialog is closed.
699+ // /
700+ /* --cef()--*/
701+ virtual void OnDialogClosed (CefRefPtr<CefBrowser> browser) OVERRIDE;
702+
703+
643704private:
644705
645706 // Include the default reference counting implementation.
0 commit comments