Add support for GetAuthCredentials (fixes issue #2718, see issue #2622).

When NetworkService is enabled requests created using CefFrame::CreateURLRequest
will call CefRequestHandler::GetAuthCredentials for the associated browser after
calling CefURLRequestClient::GetAuthCredentials if that call returns false.
This commit is contained in:
Marshall Greenblatt
2019-07-12 16:44:43 -04:00
parent ac2cc54e13
commit 3f1ebebde5
30 changed files with 859 additions and 77 deletions

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=8155639f093ff697fd30a9e330ae3470108251e5$
// $hash=5036c24365fa0fdb3d7efc54670f3123a7104fa0$
//
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
@@ -355,6 +355,22 @@ void CefRequestContextCToCpp::ClearCertificateExceptions(
_struct, CefCompletionCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall")
void CefRequestContextCToCpp::ClearHttpAuthCredentials(
CefRefPtr<CefCompletionCallback> callback) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, clear_http_auth_credentials))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: callback
// Execute
_struct->clear_http_auth_credentials(
_struct, CefCompletionCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall")
void CefRequestContextCToCpp::CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=00889895e17ac49f55668e395aa98a5f8312ee31$
// $hash=dd07d0157b7e9128b240ed2b059f2358ebf9fc09$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
@@ -63,6 +63,8 @@ class CefRequestContextCToCpp
CefString& error) OVERRIDE;
void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
void ClearHttpAuthCredentials(
CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
void CloseAllConnections(CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
void ResolveHost(const CefString& origin,
CefRefPtr<CefResolveCallback> callback) OVERRIDE;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f286ec7520ee6b589b3ecafa409eb3f71c081e27$
// $hash=ad2fb4fa8e7c8e265de6e03e2c8c8d3d28a7fd39$
//
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
@@ -151,7 +151,7 @@ CefRequestHandlerCToCpp::GetResourceRequestHandler(
NO_SANITIZE("cfi-icall")
bool CefRequestHandlerCToCpp::GetAuthCredentials(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& origin_url,
bool isProxy,
const CefString& host,
int port,
@@ -170,9 +170,9 @@ bool CefRequestHandlerCToCpp::GetAuthCredentials(
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
// Verify param: origin_url; type: string_byref_const
DCHECK(!origin_url.empty());
if (origin_url.empty())
return false;
// Verify param: host; type: string_byref_const
DCHECK(!host.empty());
@@ -186,8 +186,8 @@ bool CefRequestHandlerCToCpp::GetAuthCredentials(
// Execute
int _retval = _struct->get_auth_credentials(
_struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
isProxy, host.GetStruct(), port, realm.GetStruct(), scheme.GetStruct(),
_struct, CefBrowserCppToC::Wrap(browser), origin_url.GetStruct(), isProxy,
host.GetStruct(), port, realm.GetStruct(), scheme.GetStruct(),
CefAuthCallbackCppToC::Wrap(callback));
// Return type: bool

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1e21398533e04c0dbd4143a3847b44fb43c64bc5$
// $hash=dab1901a0bbeda97ef1efc8e5852964c318775f6$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_
@@ -54,7 +54,7 @@ class CefRequestHandlerCToCpp
const CefString& request_initiator,
bool& disable_default_handling) override;
bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& origin_url,
bool isProxy,
const CefString& host,
int port,