mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Initial changes to allow use of CefLoadHandler in the render process (issue #1077).
- Move OnLoadingStateChange from CefDisplayHandler to CefLoadHandler. - Move OnRenderProcessTerminated and OnPluginCrashed from CefLoadHandler to CefRequestHandler. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1441 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
4eafb2ea24
commit
c577293d96
@ -55,16 +55,6 @@ typedef struct _cef_display_handler_t {
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
///
|
||||
void (CEF_CALLBACK *on_loading_state_change)(
|
||||
struct _cef_display_handler_t* self, struct _cef_browser_t* browser,
|
||||
int isLoading, int canGoBack, int canGoForward);
|
||||
|
||||
///
|
||||
// Called when a frame's address has changed.
|
||||
///
|
||||
|
@ -55,6 +55,16 @@ typedef struct _cef_load_handler_t {
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
///
|
||||
void (CEF_CALLBACK *on_loading_state_change)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, int isLoading, int canGoBack,
|
||||
int canGoForward);
|
||||
|
||||
///
|
||||
// Called when the browser begins loading a frame. The |frame| value will
|
||||
// never be NULL -- call the is_main() function to check if this frame is the
|
||||
@ -62,7 +72,7 @@ typedef struct _cef_load_handler_t {
|
||||
// start or continue loading after the main frame load has ended. This
|
||||
// function may not be called for a particular frame if the load request for
|
||||
// that frame fails. For notification of overall browser load status use
|
||||
// cef_display_handler_t:: OnLoadingStateChange instead.
|
||||
// OnLoadingStateChange instead.
|
||||
///
|
||||
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
|
||||
@ -89,21 +99,6 @@ typedef struct _cef_load_handler_t {
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
enum cef_errorcode_t errorCode, const cef_string_t* errorText,
|
||||
const cef_string_t* failedUrl);
|
||||
|
||||
///
|
||||
// Called when the render process terminates unexpectedly. |status| indicates
|
||||
// how the process terminated.
|
||||
///
|
||||
void (CEF_CALLBACK *on_render_process_terminated)(
|
||||
struct _cef_load_handler_t* self, struct _cef_browser_t* browser,
|
||||
enum cef_termination_status_t status);
|
||||
|
||||
///
|
||||
// Called when a plugin has crashed. |plugin_path| is the path of the plugin
|
||||
// that crashed.
|
||||
///
|
||||
void (CEF_CALLBACK *on_plugin_crashed)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* plugin_path);
|
||||
} cef_load_handler_t;
|
||||
|
||||
|
||||
|
@ -100,8 +100,8 @@ typedef struct _cef_request_handler_t {
|
||||
// Called on the UI thread before browser navigation. Return true (1) to
|
||||
// cancel the navigation or false (0) to allow the navigation to proceed. The
|
||||
// |request| object cannot be modified in this callback.
|
||||
// cef_display_handler_t::OnLoadingStateChange will be called twice in all
|
||||
// cases. If the navigation is allowed cef_load_handler_t::OnLoadStart and
|
||||
// cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
|
||||
// If the navigation is allowed cef_load_handler_t::OnLoadStart and
|
||||
// cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
|
||||
// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
|
||||
// ERR_ABORTED.
|
||||
@ -173,14 +173,6 @@ typedef struct _cef_request_handler_t {
|
||||
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* url, int* allow_os_execution);
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a plugin is loaded. Return
|
||||
// true (1) to block loading of the plugin.
|
||||
///
|
||||
int (CEF_CALLBACK *on_before_plugin_load)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||
const cef_string_t* policy_url, struct _cef_web_plugin_info_t* info);
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
// certificate. Return true (1) and call
|
||||
@ -194,6 +186,29 @@ typedef struct _cef_request_handler_t {
|
||||
int (CEF_CALLBACK *on_certificate_error)(struct _cef_request_handler_t* self,
|
||||
enum cef_errorcode_t cert_error, const cef_string_t* request_url,
|
||||
struct _cef_allow_certificate_error_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a plugin is loaded. Return
|
||||
// true (1) to block loading of the plugin.
|
||||
///
|
||||
int (CEF_CALLBACK *on_before_plugin_load)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||
const cef_string_t* policy_url, struct _cef_web_plugin_info_t* info);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when a plugin has crashed.
|
||||
// |plugin_path| is the path of the plugin that crashed.
|
||||
///
|
||||
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 process terminates
|
||||
// unexpectedly. |status| indicates how the process terminated.
|
||||
///
|
||||
void (CEF_CALLBACK *on_render_process_terminated)(
|
||||
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||
enum cef_termination_status_t status);
|
||||
} cef_request_handler_t;
|
||||
|
||||
|
||||
|
@ -49,18 +49,6 @@
|
||||
/*--cef(source=client)--*/
|
||||
class CefDisplayHandler : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {}
|
||||
|
||||
///
|
||||
// Called when a frame's address has changed.
|
||||
///
|
||||
|
@ -50,7 +50,18 @@
|
||||
class CefLoadHandler : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_errorcode_t ErrorCode;
|
||||
typedef cef_termination_status_t TerminationStatus;
|
||||
|
||||
///
|
||||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {}
|
||||
|
||||
///
|
||||
// Called when the browser begins loading a frame. The |frame| value will
|
||||
@ -59,7 +70,7 @@ class CefLoadHandler : public virtual CefBase {
|
||||
// start or continue loading after the main frame load has ended. This method
|
||||
// may not be called for a particular frame if the load request for that frame
|
||||
// fails. For notification of overall browser load status use
|
||||
// CefDisplayHandler:: OnLoadingStateChange instead.
|
||||
// OnLoadingStateChange instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
@ -90,22 +101,6 @@ class CefLoadHandler : public virtual CefBase {
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) {}
|
||||
|
||||
///
|
||||
// Called when the render process terminates unexpectedly. |status| indicates
|
||||
// how the process terminated.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
|
||||
///
|
||||
// Called when a plugin has crashed. |plugin_path| is the path of the plugin
|
||||
// that crashed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_LOAD_HANDLER_H_
|
||||
|
@ -91,11 +91,13 @@ class CefAllowCertificateErrorCallback : public virtual CefBase {
|
||||
/*--cef(source=client)--*/
|
||||
class CefRequestHandler : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_termination_status_t TerminationStatus;
|
||||
|
||||
///
|
||||
// Called on the UI thread before browser navigation. Return true to cancel
|
||||
// the navigation or false to allow the navigation to proceed. The |request|
|
||||
// object cannot be modified in this callback.
|
||||
// CefDisplayHandler::OnLoadingStateChange will be called twice in all cases.
|
||||
// CefLoadHandler::OnLoadingStateChange will be called twice in all cases.
|
||||
// If the navigation is allowed CefLoadHandler::OnLoadStart and
|
||||
// CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled
|
||||
// CefLoadHandler::OnLoadError will be called with an |errorCode| value of
|
||||
@ -193,18 +195,6 @@ class CefRequestHandler : public virtual CefBase {
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) {}
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a plugin is loaded. Return
|
||||
// true to block loading of the plugin.
|
||||
///
|
||||
/*--cef(optional_param=url,optional_param=policy_url)--*/
|
||||
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
const CefString& policy_url,
|
||||
CefRefPtr<CefWebPluginInfo> info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid
|
||||
// SSL certificate. Return true and call CefAllowCertificateErrorCallback::
|
||||
@ -221,6 +211,35 @@ class CefRequestHandler : public virtual CefBase {
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a plugin is loaded. Return
|
||||
// true to block loading of the plugin.
|
||||
///
|
||||
/*--cef(optional_param=url,optional_param=policy_url)--*/
|
||||
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
const CefString& policy_url,
|
||||
CefRefPtr<CefWebPluginInfo> info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when a plugin has crashed.
|
||||
// |plugin_path| is the path of the plugin that crashed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the render process
|
||||
// terminates unexpectedly. |status| indicates how the process
|
||||
// terminated.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||
|
@ -1462,7 +1462,7 @@ void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source) {
|
||||
}
|
||||
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
handler->OnLoadingStateChange(this, is_loading, can_go_back,
|
||||
can_go_forward);
|
||||
@ -1841,7 +1841,7 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
||||
return;
|
||||
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler.get())
|
||||
handler->OnRenderProcessTerminated(this, ts);
|
||||
}
|
||||
@ -1895,7 +1895,7 @@ void CefBrowserHostImpl::DidFailLoad(
|
||||
void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler.get())
|
||||
handler->OnPluginCrashed(this, plugin_path.value());
|
||||
}
|
||||
|
@ -17,27 +17,6 @@
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK display_handler_on_loading_state_change(
|
||||
struct _cef_display_handler_t* self, cef_browser_t* browser, int isLoading,
|
||||
int canGoBack, int canGoForward) {
|
||||
// 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
|
||||
CefDisplayHandlerCppToC::Get(self)->OnLoadingStateChange(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
isLoading?true:false,
|
||||
canGoBack?true:false,
|
||||
canGoForward?true:false);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK display_handler_on_address_change(
|
||||
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, const cef_string_t* url) {
|
||||
@ -162,8 +141,6 @@ int CEF_CALLBACK display_handler_on_console_message(
|
||||
CefDisplayHandlerCppToC::CefDisplayHandlerCppToC(CefDisplayHandler* cls)
|
||||
: CefCppToC<CefDisplayHandlerCppToC, CefDisplayHandler,
|
||||
cef_display_handler_t>(cls) {
|
||||
struct_.struct_.on_loading_state_change =
|
||||
display_handler_on_loading_state_change;
|
||||
struct_.struct_.on_address_change = display_handler_on_address_change;
|
||||
struct_.struct_.on_title_change = display_handler_on_title_change;
|
||||
struct_.struct_.on_tooltip = display_handler_on_tooltip;
|
||||
|
@ -17,6 +17,27 @@
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK load_handler_on_loading_state_change(
|
||||
struct _cef_load_handler_t* self, cef_browser_t* browser, int isLoading,
|
||||
int canGoBack, int canGoForward) {
|
||||
// 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
|
||||
CefLoadHandlerCppToC::Get(self)->OnLoadingStateChange(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
isLoading?true:false,
|
||||
canGoBack?true:false,
|
||||
canGoForward?true:false);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self,
|
||||
cef_browser_t* browser, cef_frame_t* frame) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -93,59 +114,16 @@ void CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self,
|
||||
CefString(failedUrl));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK load_handler_on_render_process_terminated(
|
||||
struct _cef_load_handler_t* self, cef_browser_t* browser,
|
||||
enum cef_termination_status_t status) {
|
||||
// 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
|
||||
CefLoadHandlerCppToC::Get(self)->OnRenderProcessTerminated(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
status);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK load_handler_on_plugin_crashed(
|
||||
struct _cef_load_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* plugin_path) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: plugin_path; type: string_byref_const
|
||||
DCHECK(plugin_path);
|
||||
if (!plugin_path)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefLoadHandlerCppToC::Get(self)->OnPluginCrashed(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(plugin_path));
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefLoadHandlerCppToC::CefLoadHandlerCppToC(CefLoadHandler* cls)
|
||||
: CefCppToC<CefLoadHandlerCppToC, CefLoadHandler, cef_load_handler_t>(cls) {
|
||||
struct_.struct_.on_loading_state_change =
|
||||
load_handler_on_loading_state_change;
|
||||
struct_.struct_.on_load_start = load_handler_on_load_start;
|
||||
struct_.struct_.on_load_end = load_handler_on_load_end;
|
||||
struct_.struct_.on_load_error = load_handler_on_load_error;
|
||||
struct_.struct_.on_render_process_terminated =
|
||||
load_handler_on_render_process_terminated;
|
||||
struct_.struct_.on_plugin_crashed = load_handler_on_plugin_crashed;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -270,6 +270,34 @@ void CEF_CALLBACK request_handler_on_protocol_execution(
|
||||
*allow_os_execution = allow_os_executionBool?true:false;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK request_handler_on_certificate_error(
|
||||
struct _cef_request_handler_t* self, enum cef_errorcode_t cert_error,
|
||||
const cef_string_t* request_url,
|
||||
cef_allow_certificate_error_callback_t* callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: request_url; type: string_byref_const
|
||||
DCHECK(request_url);
|
||||
if (!request_url)
|
||||
return 0;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefRequestHandlerCppToC::Get(self)->OnCertificateError(
|
||||
cert_error,
|
||||
CefString(request_url),
|
||||
CefAllowCertificateErrorCallbackCToCpp::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK request_handler_on_before_plugin_load(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* url, const cef_string_t* policy_url,
|
||||
@ -300,32 +328,46 @@ int CEF_CALLBACK request_handler_on_before_plugin_load(
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK request_handler_on_certificate_error(
|
||||
struct _cef_request_handler_t* self, enum cef_errorcode_t cert_error,
|
||||
const cef_string_t* request_url,
|
||||
cef_allow_certificate_error_callback_t* callback) {
|
||||
void CEF_CALLBACK request_handler_on_plugin_crashed(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* plugin_path) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: request_url; type: string_byref_const
|
||||
DCHECK(request_url);
|
||||
if (!request_url)
|
||||
return 0;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return 0;
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: plugin_path; type: string_byref_const
|
||||
DCHECK(plugin_path);
|
||||
if (!plugin_path)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefRequestHandlerCppToC::Get(self)->OnCertificateError(
|
||||
cert_error,
|
||||
CefString(request_url),
|
||||
CefAllowCertificateErrorCallbackCToCpp::Wrap(callback));
|
||||
CefRequestHandlerCppToC::Get(self)->OnPluginCrashed(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(plugin_path));
|
||||
}
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
void CEF_CALLBACK request_handler_on_render_process_terminated(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
enum cef_termination_status_t status) {
|
||||
// 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)->OnRenderProcessTerminated(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
status);
|
||||
}
|
||||
|
||||
|
||||
@ -342,8 +384,11 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
||||
struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials;
|
||||
struct_.struct_.on_quota_request = request_handler_on_quota_request;
|
||||
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
||||
struct_.struct_.on_before_plugin_load = request_handler_on_before_plugin_load;
|
||||
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_process_terminated =
|
||||
request_handler_on_render_process_terminated;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -17,27 +17,6 @@
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefDisplayHandlerCToCpp::OnLoadingStateChange(
|
||||
CefRefPtr<CefBrowser> browser, bool isLoading, bool canGoBack,
|
||||
bool canGoForward) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_loading_state_change))
|
||||
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_loading_state_change(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
isLoading,
|
||||
canGoBack,
|
||||
canGoForward);
|
||||
}
|
||||
|
||||
void CefDisplayHandlerCToCpp::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const CefString& url) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_address_change))
|
||||
|
@ -34,8 +34,6 @@ class CefDisplayHandlerCToCpp
|
||||
virtual ~CefDisplayHandlerCToCpp() {}
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading, bool canGoBack, bool canGoForward) OVERRIDE;
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const CefString& url) OVERRIDE;
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -17,6 +17,26 @@
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefLoadHandlerCToCpp::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading, bool canGoBack, bool canGoForward) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_loading_state_change))
|
||||
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_loading_state_change(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
isLoading,
|
||||
canGoBack,
|
||||
canGoForward);
|
||||
}
|
||||
|
||||
void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_load_start))
|
||||
@ -93,46 +113,6 @@ void CefLoadHandlerCToCpp::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
failedUrl.GetStruct());
|
||||
}
|
||||
|
||||
void CefLoadHandlerCToCpp::OnRenderProcessTerminated(
|
||||
CefRefPtr<CefBrowser> browser, TerminationStatus status) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_render_process_terminated))
|
||||
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_process_terminated(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
status);
|
||||
}
|
||||
|
||||
void CefLoadHandlerCToCpp::OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_plugin_crashed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: plugin_path; type: string_byref_const
|
||||
DCHECK(!plugin_path.empty());
|
||||
if (plugin_path.empty())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->on_plugin_crashed(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
plugin_path.GetStruct());
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefLoadHandlerCToCpp, CefLoadHandler,
|
||||
|
@ -34,6 +34,8 @@ class CefLoadHandlerCToCpp
|
||||
virtual ~CefLoadHandlerCToCpp() {}
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading, bool canGoBack, bool canGoForward) OVERRIDE;
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) OVERRIDE;
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
@ -41,10 +43,6 @@ class CefLoadHandlerCToCpp
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
|
||||
const CefString& errorText, const CefString& failedUrl) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
@ -252,6 +252,33 @@ void CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
allow_os_execution = allow_os_executionInt?true:false;
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnCertificateError(cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_certificate_error))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: request_url; type: string_byref_const
|
||||
DCHECK(!request_url.empty());
|
||||
if (request_url.empty())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_certificate_error(struct_,
|
||||
cert_error,
|
||||
request_url.GetStruct(),
|
||||
CefAllowCertificateErrorCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, const CefString& policy_url,
|
||||
CefRefPtr<CefWebPluginInfo> info) {
|
||||
@ -281,31 +308,44 @@ bool CefRequestHandlerCToCpp::OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnCertificateError(cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_certificate_error))
|
||||
return false;
|
||||
void CefRequestHandlerCToCpp::OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_plugin_crashed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: request_url; type: string_byref_const
|
||||
DCHECK(!request_url.empty());
|
||||
if (request_url.empty())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return false;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: plugin_path; type: string_byref_const
|
||||
DCHECK(!plugin_path.empty());
|
||||
if (plugin_path.empty())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_certificate_error(struct_,
|
||||
cert_error,
|
||||
request_url.GetStruct(),
|
||||
CefAllowCertificateErrorCallbackCppToC::Wrap(callback));
|
||||
struct_->on_plugin_crashed(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
plugin_path.GetStruct());
|
||||
}
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
void CefRequestHandlerCToCpp::OnRenderProcessTerminated(
|
||||
CefRefPtr<CefBrowser> browser, TerminationStatus status) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_render_process_terminated))
|
||||
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_process_terminated(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,12 +54,16 @@ class CefRequestHandlerCToCpp
|
||||
CefRefPtr<CefQuotaCallback> callback) OVERRIDE;
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, bool& allow_os_execution) OVERRIDE;
|
||||
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, const CefString& policy_url,
|
||||
CefRefPtr<CefWebPluginInfo> info) OVERRIDE;
|
||||
virtual bool OnCertificateError(cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) OVERRIDE;
|
||||
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, const CefString& policy_url,
|
||||
CefRefPtr<CefWebPluginInfo> info) OVERRIDE;
|
||||
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& plugin_path) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
@ -189,15 +189,6 @@ bool ClientHandler::OnContextMenuCommand(
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
REQUIRE_UI_THREAD();
|
||||
SetLoading(isLoading);
|
||||
SetNavState(canGoBack, canGoForward);
|
||||
}
|
||||
|
||||
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
@ -392,27 +383,18 @@ void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) {
|
||||
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// We've just started loading a page
|
||||
SetLoading(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// We've just finished loading a page
|
||||
SetLoading(false);
|
||||
SetLoading(isLoading);
|
||||
SetNavState(canGoBack, canGoForward);
|
||||
|
||||
if (!isLoading) {
|
||||
// Continue the DOM test.
|
||||
if (frame->GetURL() == dom_test::kTestUrl)
|
||||
if (browser->GetMainFrame()->GetURL() == dom_test::kTestUrl)
|
||||
dom_test::OnLoadEnd(browser);
|
||||
}
|
||||
}
|
||||
@ -445,18 +427,6 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
frame->LoadString(ss.str(), failedUrl);
|
||||
}
|
||||
|
||||
void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {
|
||||
// Load the startup URL if that's not the website that we terminated on.
|
||||
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
|
||||
std::string url = frame->GetURL();
|
||||
std::transform(url.begin(), url.end(), url.begin(), tolower);
|
||||
|
||||
std::string startupURL = GetStartupURL();
|
||||
if (url.find(startupURL) != 0)
|
||||
frame->LoadURL(startupURL);
|
||||
}
|
||||
|
||||
CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
@ -512,6 +482,18 @@ void ClientHandler::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
allow_os_execution = true;
|
||||
}
|
||||
|
||||
void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {
|
||||
// Load the startup URL if that's not the website that we terminated on.
|
||||
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
|
||||
std::string url = frame->GetURL();
|
||||
std::transform(url.begin(), url.end(), url.begin(), tolower);
|
||||
|
||||
std::string startupURL = GetStartupURL();
|
||||
if (url.find(startupURL) != 0)
|
||||
frame->LoadURL(startupURL);
|
||||
}
|
||||
|
||||
bool ClientHandler::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) {
|
||||
if (!m_OSRHandler.get())
|
||||
|
@ -109,10 +109,6 @@ class ClientHandler : public CefClient,
|
||||
EventFlags event_flags) OVERRIDE;
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) OVERRIDE;
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) OVERRIDE;
|
||||
@ -167,18 +163,15 @@ class ClientHandler : public CefClient,
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) OVERRIDE;
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) OVERRIDE;
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) OVERRIDE;
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
|
||||
// CefRequestHandler methods
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
@ -192,6 +185,8 @@ class ClientHandler : public CefClient,
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
|
||||
// CefRenderHandler methods
|
||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
|
Loading…
x
Reference in New Issue
Block a user