Add callbacks for network request access to cookies (issue #2374)

This commit is contained in:
Marshall Greenblatt
2018-02-05 19:21:14 -05:00
parent d7e1312e9d
commit d34d3d1b3b
15 changed files with 1177 additions and 11 deletions

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=419fbbe47f1b127719554892609c02a3b135c44d$
// $hash=b4c3eec00b1889871f4e13ea05d7c00a12da1fa0$
//
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
@ -367,6 +367,80 @@ request_handler_get_auth_credentials(struct _cef_request_handler_t* self,
return _retval;
}
int CEF_CALLBACK
request_handler_can_get_cookies(struct _cef_request_handler_t* self,
cef_browser_t* browser,
cef_frame_t* frame,
cef_request_t* request) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
// Verify param: request; type: refptr_diff
DCHECK(request);
if (!request)
return 0;
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->CanGetCookies(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
CefRequestCToCpp::Wrap(request));
// Return type: bool
return _retval;
}
int CEF_CALLBACK
request_handler_can_set_cookie(struct _cef_request_handler_t* self,
cef_browser_t* browser,
cef_frame_t* frame,
cef_request_t* request,
const struct _cef_cookie_t* cookie) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
// Verify param: request; type: refptr_diff
DCHECK(request);
if (!request)
return 0;
// Verify param: cookie; type: struct_byref_const
DCHECK(cookie);
if (!cookie)
return 0;
// Translate param: cookie; type: struct_byref_const
CefCookie cookieObj;
if (cookie)
cookieObj.Set(*cookie, false);
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->CanSetCookie(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
CefRequestCToCpp::Wrap(request), cookieObj);
// Return type: bool
return _retval;
}
int CEF_CALLBACK
request_handler_on_quota_request(struct _cef_request_handler_t* self,
cef_browser_t* browser,
@ -603,6 +677,8 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC() {
GetStruct()->on_resource_load_complete =
request_handler_on_resource_load_complete;
GetStruct()->get_auth_credentials = request_handler_get_auth_credentials;
GetStruct()->can_get_cookies = request_handler_can_get_cookies;
GetStruct()->can_set_cookie = request_handler_can_set_cookie;
GetStruct()->on_quota_request = request_handler_on_quota_request;
GetStruct()->on_protocol_execution = request_handler_on_protocol_execution;
GetStruct()->on_certificate_error = request_handler_on_certificate_error;