Add a new CefRequestHandler::OnRenderViewReady method which is called when a browser is ready to receive/handle IPC messages in the render process (issue #1564).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2055 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
c49473729d
commit
9dc7d2a398
|
@ -232,6 +232,14 @@ typedef struct _cef_request_handler_t {
|
|||
void (CEF_CALLBACK *on_plugin_crashed)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* plugin_path);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the render view associated
|
||||
// with |browser| is ready to receive/handle IPC messages in the render
|
||||
// process.
|
||||
///
|
||||
void (CEF_CALLBACK *on_render_view_ready)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the render process terminates
|
||||
// unexpectedly. |status| indicates how the process terminated.
|
||||
|
|
|
@ -261,6 +261,14 @@ class CefRequestHandler : public virtual CefBase {
|
|||
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the render view associated
|
||||
// with |browser| is ready to receive/handle IPC messages in the render
|
||||
// process.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderViewReady(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the render process
|
||||
// terminates unexpectedly. |status| indicates how the process
|
||||
|
|
|
@ -2447,6 +2447,12 @@ void CefBrowserHostImpl::RenderViewReady() {
|
|||
Send(queued_messages_.front());
|
||||
queued_messages_.pop();
|
||||
}
|
||||
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler.get())
|
||||
handler->OnRenderViewReady(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
||||
|
|
|
@ -397,6 +397,23 @@ void CEF_CALLBACK request_handler_on_plugin_crashed(
|
|||
CefString(plugin_path));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_handler_on_render_view_ready(
|
||||
struct _cef_request_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
|
||||
CefRequestHandlerCppToC::Get(self)->OnRenderViewReady(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_handler_on_render_process_terminated(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
cef_termination_status_t status) {
|
||||
|
@ -434,6 +451,7 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
|||
struct_.struct_.on_certificate_error = request_handler_on_certificate_error;
|
||||
struct_.struct_.on_before_plugin_load = request_handler_on_before_plugin_load;
|
||||
struct_.struct_.on_plugin_crashed = request_handler_on_plugin_crashed;
|
||||
struct_.struct_.on_render_view_ready = request_handler_on_render_view_ready;
|
||||
struct_.struct_.on_render_process_terminated =
|
||||
request_handler_on_render_process_terminated;
|
||||
}
|
||||
|
|
|
@ -375,6 +375,22 @@ void CefRequestHandlerCToCpp::OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
|||
plugin_path.GetStruct());
|
||||
}
|
||||
|
||||
void CefRequestHandlerCToCpp::OnRenderViewReady(CefRefPtr<CefBrowser> browser) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_render_view_ready))
|
||||
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_render_view_ready(struct_,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
void CefRequestHandlerCToCpp::OnRenderProcessTerminated(
|
||||
CefRefPtr<CefBrowser> browser, TerminationStatus status) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_render_process_terminated))
|
||||
|
|
|
@ -63,6 +63,7 @@ class CefRequestHandlerCToCpp
|
|||
const CefString& policy_url, CefRefPtr<CefWebPluginInfo> info) override;
|
||||
void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) override;
|
||||
void OnRenderViewReady(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) override;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue