Add HandleProtocolExecution event for unregistered protocols (issue #155).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@163 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-01-12 01:33:03 +00:00
parent bf02152631
commit 013c008775
13 changed files with 217 additions and 4 deletions

View File

@@ -215,6 +215,22 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
return rv;
}
enum cef_retval_t CEF_CALLBACK handler_handle_protocol_execution(
struct _cef_handler_t* self, cef_browser_t* browser,
const cef_string_t* url, int* allow_os_execution)
{
DCHECK(self);
DCHECK(browser);
if(!self || !browser)
return RV_CONTINUE;
bool allowExec = *allow_os_execution?true:false;
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleProtocolExecution(
CefBrowserCToCpp::Wrap(browser), CefString(url), &allowExec);
*allow_os_execution = allowExec?true:false;
return rv;
}
enum cef_retval_t CEF_CALLBACK handler_handle_download_response(
struct _cef_handler_t* self, cef_browser_t* browser,
const cef_string_t* mimeType, const cef_string_t* fileName,
@@ -533,6 +549,7 @@ CefHandlerCppToC::CefHandlerCppToC(CefHandler* cls)
struct_.struct_.handle_load_error = handler_handle_load_error;
struct_.struct_.handle_before_resource_load =
handler_handle_before_resource_load;
struct_.struct_.handle_protocol_execution = handler_handle_protocol_execution;
struct_.struct_.handle_download_response = handler_handle_download_response;
struct_.struct_.handle_authentication_request =
handler_handle_authentication_request;

View File

@@ -160,6 +160,20 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeResourceLoad(
return rv;
}
CefHandler::RetVal CefHandlerCToCpp::HandleProtocolExecution(
CefRefPtr<CefBrowser> browser, const CefString& url,
bool* allow_os_execution)
{
if(CEF_MEMBER_MISSING(struct_, handle_protocol_execution))
return RV_CONTINUE;
int allowExec = *allow_os_execution?1:0;
cef_retval_t rv = struct_->handle_protocol_execution(struct_,
CefBrowserCppToC::Wrap(browser), url.GetStruct(), &allowExec);
*allow_os_execution = allowExec?true:false;
return rv;
}
CefHandler::RetVal CefHandlerCToCpp::HandleDownloadResponse(
CefRefPtr<CefBrowser> browser, const CefString& mimeType,
const CefString& fileName, int64 contentLength,

View File

@@ -54,6 +54,8 @@ public:
CefRefPtr<CefRequest> request, CefString& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream, CefString& mimeType,
int loadFlags);
virtual RetVal HandleProtocolExecution(CefRefPtr<CefBrowser> browser,
const CefString& url, bool* allow_os_execution);
virtual RetVal HandleDownloadResponse(CefRefPtr<CefBrowser> browser,
const CefString& mimeType, const CefString& fileName,
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler);