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:
Marshall Greenblatt
2013-09-12 20:34:18 +00:00
parent 4eafb2ea24
commit c577293d96
18 changed files with 286 additions and 308 deletions

View File

@@ -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.
///

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.
///

View File

@@ -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_

View File

@@ -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_