- Allow asynchronous continuation of OnBeforeResourceLoad (issue #1593).

- Use CefRequestCallback for most asynchronous CefRequestHandler methods.
This commit is contained in:
Marshall Greenblatt
2015-04-02 17:21:46 +02:00
parent a82110b31e
commit 4a905f1e2b
26 changed files with 582 additions and 423 deletions

View File

@ -1,47 +0,0 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/allow_certificate_error_callback_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK allow_certificate_error_callback_cont(
struct _cef_allow_certificate_error_callback_t* self, int allow) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefAllowCertificateErrorCallbackCppToC::Get(self)->Continue(
allow?true:false);
}
// CONSTRUCTOR - Do not edit by hand.
CefAllowCertificateErrorCallbackCppToC::CefAllowCertificateErrorCallbackCppToC(
CefAllowCertificateErrorCallback* cls)
: CefCppToC<CefAllowCertificateErrorCallbackCppToC,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t>(cls) {
struct_.struct_.cont = allow_certificate_error_callback_cont;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefAllowCertificateErrorCallbackCppToC,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t>::DebugObjCt = 0;
#endif

View File

@ -1,38 +0,0 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_ALLOW_CERTIFICATE_ERROR_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_ALLOW_CERTIFICATE_ERROR_CALLBACK_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_request_handler.h"
#include "include/capi/cef_request_handler_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefAllowCertificateErrorCallbackCppToC
: public CefCppToC<CefAllowCertificateErrorCallbackCppToC,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t> {
public:
explicit CefAllowCertificateErrorCallbackCppToC(
CefAllowCertificateErrorCallback* cls);
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_ALLOW_CERTIFICATE_ERROR_CALLBACK_CPPTOC_H_

View File

@ -10,12 +10,12 @@
// for more information.
//
#include "libcef_dll/cpptoc/quota_callback_cpptoc.h"
#include "libcef_dll/cpptoc/request_callback_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK quota_callback_cont(struct _cef_quota_callback_t* self,
void CEF_CALLBACK request_callback_cont(struct _cef_request_callback_t* self,
int allow) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -24,11 +24,12 @@ void CEF_CALLBACK quota_callback_cont(struct _cef_quota_callback_t* self,
return;
// Execute
CefQuotaCallbackCppToC::Get(self)->Continue(
CefRequestCallbackCppToC::Get(self)->Continue(
allow?true:false);
}
void CEF_CALLBACK quota_callback_cancel(struct _cef_quota_callback_t* self) {
void CEF_CALLBACK request_callback_cancel(
struct _cef_request_callback_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -36,21 +37,21 @@ void CEF_CALLBACK quota_callback_cancel(struct _cef_quota_callback_t* self) {
return;
// Execute
CefQuotaCallbackCppToC::Get(self)->Cancel();
CefRequestCallbackCppToC::Get(self)->Cancel();
}
// CONSTRUCTOR - Do not edit by hand.
CefQuotaCallbackCppToC::CefQuotaCallbackCppToC(CefQuotaCallback* cls)
: CefCppToC<CefQuotaCallbackCppToC, CefQuotaCallback, cef_quota_callback_t>(
cls) {
struct_.struct_.cont = quota_callback_cont;
struct_.struct_.cancel = quota_callback_cancel;
CefRequestCallbackCppToC::CefRequestCallbackCppToC(CefRequestCallback* cls)
: CefCppToC<CefRequestCallbackCppToC, CefRequestCallback,
cef_request_callback_t>(cls) {
struct_.struct_.cont = request_callback_cont;
struct_.struct_.cancel = request_callback_cancel;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefQuotaCallbackCppToC,
CefQuotaCallback, cef_quota_callback_t>::DebugObjCt = 0;
template<> base::AtomicRefCount CefCppToC<CefRequestCallbackCppToC,
CefRequestCallback, cef_request_callback_t>::DebugObjCt = 0;
#endif

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_REQUEST_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_REQUEST_CALLBACK_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
@ -24,13 +24,13 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefQuotaCallbackCppToC
: public CefCppToC<CefQuotaCallbackCppToC, CefQuotaCallback,
cef_quota_callback_t> {
class CefRequestCallbackCppToC
: public CefCppToC<CefRequestCallbackCppToC, CefRequestCallback,
cef_request_callback_t> {
public:
explicit CefQuotaCallbackCppToC(CefQuotaCallback* cls);
explicit CefRequestCallbackCppToC(CefRequestCallback* cls);
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_REQUEST_CALLBACK_CPPTOC_H_

View File

@ -12,12 +12,11 @@
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
#include "libcef_dll/cpptoc/resource_handler_cpptoc.h"
#include "libcef_dll/ctocpp/allow_certificate_error_callback_ctocpp.h"
#include "libcef_dll/ctocpp/auth_callback_ctocpp.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/ctocpp/quota_callback_ctocpp.h"
#include "libcef_dll/ctocpp/request_ctocpp.h"
#include "libcef_dll/ctocpp/request_callback_ctocpp.h"
#include "libcef_dll/ctocpp/response_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
@ -91,34 +90,41 @@ int CEF_CALLBACK request_handler_on_open_urlfrom_tab(
return _retval;
}
int CEF_CALLBACK request_handler_on_before_resource_load(
cef_return_value_t CEF_CALLBACK request_handler_on_before_resource_load(
struct _cef_request_handler_t* self, cef_browser_t* browser,
cef_frame_t* frame, cef_request_t* request) {
cef_frame_t* frame, cef_request_t* request,
cef_request_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
return RV_CONTINUE;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
return RV_CONTINUE;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
return RV_CONTINUE;
// Verify param: request; type: refptr_diff
DCHECK(request);
if (!request)
return 0;
return RV_CONTINUE;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return RV_CONTINUE;
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad(
cef_return_value_t _retval = CefRequestHandlerCppToC::Get(
self)->OnBeforeResourceLoad(
CefBrowserCToCpp::Wrap(browser),
CefFrameCToCpp::Wrap(frame),
CefRequestCToCpp::Wrap(request));
CefRequestCToCpp::Wrap(request),
CefRequestCallbackCToCpp::Wrap(callback));
// Return type: bool
// Return type: simple
return _retval;
}
@ -277,7 +283,7 @@ int CEF_CALLBACK request_handler_get_auth_credentials(
int CEF_CALLBACK request_handler_on_quota_request(
struct _cef_request_handler_t* self, cef_browser_t* browser,
const cef_string_t* origin_url, int64 new_size,
cef_quota_callback_t* callback) {
cef_request_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -301,7 +307,7 @@ int CEF_CALLBACK request_handler_on_quota_request(
CefBrowserCToCpp::Wrap(browser),
CefString(origin_url),
new_size,
CefQuotaCallbackCToCpp::Wrap(callback));
CefRequestCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
@ -346,8 +352,7 @@ void CEF_CALLBACK request_handler_on_protocol_execution(
int CEF_CALLBACK request_handler_on_certificate_error(
struct _cef_request_handler_t* self, cef_browser_t* browser,
cef_errorcode_t cert_error, const cef_string_t* request_url,
struct _cef_sslinfo_t* ssl_info,
cef_allow_certificate_error_callback_t* callback) {
struct _cef_sslinfo_t* ssl_info, cef_request_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -376,7 +381,7 @@ int CEF_CALLBACK request_handler_on_certificate_error(
cert_error,
CefString(request_url),
CefSSLInfoCToCpp::Wrap(ssl_info),
CefAllowCertificateErrorCallbackCToCpp::Wrap(callback));
CefRequestCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;