Add CefJSDialogHandler::OnDialogClosed callback (issue #943).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1263 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-05-31 13:45:21 +00:00
parent 3d16a39e9e
commit b3cd2ae6a8
6 changed files with 53 additions and 0 deletions

View File

@ -116,6 +116,12 @@ typedef struct _cef_jsdialog_handler_t {
///
void (CEF_CALLBACK *on_reset_dialog_state)(
struct _cef_jsdialog_handler_t* self, struct _cef_browser_t* browser);
///
// Called when the default implementation dialog is closed.
///
void (CEF_CALLBACK *on_dialog_closed)(struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser);
} cef_jsdialog_handler_t;

View File

@ -117,6 +117,12 @@ class CefJSDialogHandler : public virtual CefBase {
///
/*--cef()--*/
virtual void OnResetDialogState(CefRefPtr<CefBrowser> browser) {}
///
// Called when the default implementation dialog is closed.
///
/*--cef()--*/
virtual void OnDialogClosed(CefRefPtr<CefBrowser> browser) {}
};
#endif // CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_

View File

@ -209,5 +209,11 @@ void CefJavaScriptDialogManager::DialogClosed(CefJavaScriptDialog* dialog) {
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
DCHECK_EQ(dialog, dialog_.get());
dialog_.reset();
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
if (handler.get())
handler->OnDialogClosed(browser_);
}
#endif
}

View File

@ -116,6 +116,23 @@ void CEF_CALLBACK jsdialog_handler_on_reset_dialog_state(
CefBrowserCToCpp::Wrap(browser));
}
void CEF_CALLBACK jsdialog_handler_on_dialog_closed(
struct _cef_jsdialog_handler_t* self, cef_browser_t* browser) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Execute
CefJSDialogHandlerCppToC::Get(self)->OnDialogClosed(
CefBrowserCToCpp::Wrap(browser));
}
// CONSTRUCTOR - Do not edit by hand.
@ -127,6 +144,7 @@ CefJSDialogHandlerCppToC::CefJSDialogHandlerCppToC(CefJSDialogHandler* cls)
jsdialog_handler_on_before_unload_dialog;
struct_.struct_.on_reset_dialog_state =
jsdialog_handler_on_reset_dialog_state;
struct_.struct_.on_dialog_closed = jsdialog_handler_on_dialog_closed;
}
#ifndef NDEBUG

View File

@ -108,6 +108,22 @@ void CefJSDialogHandlerCToCpp::OnResetDialogState(
CefBrowserCppToC::Wrap(browser));
}
void CefJSDialogHandlerCToCpp::OnDialogClosed(CefRefPtr<CefBrowser> browser) {
if (CEF_MEMBER_MISSING(struct_, on_dialog_closed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Execute
struct_->on_dialog_closed(struct_,
CefBrowserCppToC::Wrap(browser));
}
#ifndef NDEBUG
template<> long CefCToCpp<CefJSDialogHandlerCToCpp, CefJSDialogHandler,

View File

@ -44,6 +44,7 @@ class CefJSDialogHandlerCToCpp
const CefString& message_text, bool is_reload,
CefRefPtr<CefJSDialogCallback> callback) OVERRIDE;
virtual void OnResetDialogState(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual void OnDialogClosed(CefRefPtr<CefBrowser> browser) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED