Add CefRequestHandler::OnBeforeBrowse callback (issue #1076).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1440 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-09-12 17:44:54 +00:00
parent 2b6285b701
commit 4eafb2ea24
14 changed files with 505 additions and 46 deletions

View File

@@ -56,7 +56,10 @@ typedef struct _cef_display_handler_t {
cef_base_t base;
///
// Called when the loading state has changed.
// 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,

View File

@@ -61,7 +61,8 @@ typedef struct _cef_load_handler_t {
// main frame. Multiple frames may be loading at the same time. Sub-frames may
// 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.
// that frame fails. For notification of overall browser load status use
// cef_display_handler_t:: OnLoadingStateChange instead.
///
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
@@ -79,10 +80,10 @@ typedef struct _cef_load_handler_t {
int httpStatusCode);
///
// Called when the browser fails to load a resource. |errorCode| is the error
// code number, |errorText| is the error text and and |failedUrl| is the URL
// that failed to load. See net\base\net_error_list.h for complete
// descriptions of the error codes.
// Called when the resource load for a navigation fails or is canceled.
// |errorCode| is the error code number, |errorText| is the error text and
// |failedUrl| is the URL that failed to load. See net\base\net_error_list.h
// for complete descriptions of the error codes.
///
void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,

View File

@@ -96,6 +96,20 @@ typedef struct _cef_request_handler_t {
///
cef_base_t base;
///
// 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::OnLoadEnd will be called. If the navigation is canceled
// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED.
///
int (CEF_CALLBACK *on_before_browse)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
struct _cef_request_t* request, int is_redirect);
///
// Called on the IO thread before a resource request is loaded. The |request|
// object may be modified. To cancel the request return true (1) otherwise

View File

@@ -50,7 +50,10 @@
class CefDisplayHandler : public virtual CefBase {
public:
///
// Called when the loading state has changed.
// 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,

View File

@@ -58,7 +58,8 @@ class CefLoadHandler : public virtual CefBase {
// main frame. Multiple frames may be loading at the same time. Sub-frames may
// 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.
// fails. For notification of overall browser load status use
// CefDisplayHandler:: OnLoadingStateChange instead.
///
/*--cef()--*/
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
@@ -78,10 +79,10 @@ class CefLoadHandler : public virtual CefBase {
int httpStatusCode) {}
///
// Called when the browser fails to load a resource. |errorCode| is the error
// code number, |errorText| is the error text and and |failedUrl| is the URL
// that failed to load. See net\base\net_error_list.h for complete
// descriptions of the error codes.
// Called when the resource load for a navigation fails or is canceled.
// |errorCode| is the error code number, |errorText| is the error text and
// |failedUrl| is the URL that failed to load. See net\base\net_error_list.h
// for complete descriptions of the error codes.
///
/*--cef(optional_param=errorText)--*/
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,

View File

@@ -91,6 +91,24 @@ class CefAllowCertificateErrorCallback : public virtual CefBase {
/*--cef(source=client)--*/
class CefRequestHandler : public virtual CefBase {
public:
///
// 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.
// 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
// ERR_ABORTED.
///
/*--cef()--*/
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) {
return false;
}
///
// Called on the IO thread before a resource request is loaded. The |request|
// object may be modified. To cancel the request return true otherwise return