- Pass SSL certificate information to CefRequestHandler::OnCertificateError via a new CefSSLInfo interface (issue #1530).

- cefclient: Improve error message text and use a data: URI instead of LoadString for loading error messages (issue #579).
- Add functions in cef_url.h for base64 and URI encoding/decoding (issue #579).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2272@2029 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2015-02-11 18:15:56 +00:00
parent 27f50277e5
commit 32d4ca36aa
34 changed files with 2004 additions and 24 deletions

View File

@ -18,6 +18,7 @@
#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/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
@ -271,18 +272,27 @@ void CEF_CALLBACK request_handler_on_protocol_execution(
}
int CEF_CALLBACK request_handler_on_certificate_error(
struct _cef_request_handler_t* self, cef_errorcode_t cert_error,
const cef_string_t* request_url,
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) {
// 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: request_url; type: string_byref_const
DCHECK(request_url);
if (!request_url)
return 0;
// Verify param: ssl_info; type: refptr_diff
DCHECK(ssl_info);
if (!ssl_info)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
@ -290,8 +300,10 @@ int CEF_CALLBACK request_handler_on_certificate_error(
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->OnCertificateError(
CefBrowserCToCpp::Wrap(browser),
cert_error,
CefString(request_url),
CefSSLInfoCToCpp::Wrap(ssl_info),
CefAllowCertificateErrorCallbackCToCpp::Wrap(callback));
// Return type: bool

View File

@ -0,0 +1,220 @@
// 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/sslcert_principal_cpptoc.h"
#include "libcef_dll/transfer_util.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
struct _cef_sslcert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetDisplayName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
struct _cef_sslcert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCommonName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
struct _cef_sslcert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetLocalityName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
struct _cef_sslcert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(
self)->GetStateOrProvinceName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
struct _cef_sslcert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCountryName();
// Return type: string
return _retval.DetachToUserFree();
}
void CEF_CALLBACK sslcert_principal_get_street_addresses(
struct _cef_sslcert_principal_t* self, cef_string_list_t addresses) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: addresses; type: string_vec_byref
DCHECK(addresses);
if (!addresses)
return;
// Translate param: addresses; type: string_vec_byref
std::vector<CefString> addressesList;
transfer_string_list_contents(addresses, addressesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetStreetAddresses(
addressesList);
// Restore param: addresses; type: string_vec_byref
cef_string_list_clear(addresses);
transfer_string_list_contents(addressesList, addresses);
}
void CEF_CALLBACK sslcert_principal_get_organization_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: names; type: string_vec_byref
DCHECK(names);
if (!names)
return;
// Translate param: names; type: string_vec_byref
std::vector<CefString> namesList;
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationNames(
namesList);
// Restore param: names; type: string_vec_byref
cef_string_list_clear(names);
transfer_string_list_contents(namesList, names);
}
void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: names; type: string_vec_byref
DCHECK(names);
if (!names)
return;
// Translate param: names; type: string_vec_byref
std::vector<CefString> namesList;
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
namesList);
// Restore param: names; type: string_vec_byref
cef_string_list_clear(names);
transfer_string_list_contents(namesList, names);
}
void CEF_CALLBACK sslcert_principal_get_domain_components(
struct _cef_sslcert_principal_t* self, cef_string_list_t components) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: components; type: string_vec_byref
DCHECK(components);
if (!components)
return;
// Translate param: components; type: string_vec_byref
std::vector<CefString> componentsList;
transfer_string_list_contents(components, componentsList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetDomainComponents(
componentsList);
// Restore param: components; type: string_vec_byref
cef_string_list_clear(components);
transfer_string_list_contents(componentsList, components);
}
// CONSTRUCTOR - Do not edit by hand.
CefSSLCertPrincipalCppToC::CefSSLCertPrincipalCppToC(CefSSLCertPrincipal* cls)
: CefCppToC<CefSSLCertPrincipalCppToC, CefSSLCertPrincipal,
cef_sslcert_principal_t>(cls) {
struct_.struct_.get_display_name = sslcert_principal_get_display_name;
struct_.struct_.get_common_name = sslcert_principal_get_common_name;
struct_.struct_.get_locality_name = sslcert_principal_get_locality_name;
struct_.struct_.get_state_or_province_name =
sslcert_principal_get_state_or_province_name;
struct_.struct_.get_country_name = sslcert_principal_get_country_name;
struct_.struct_.get_street_addresses = sslcert_principal_get_street_addresses;
struct_.struct_.get_organization_names =
sslcert_principal_get_organization_names;
struct_.struct_.get_organization_unit_names =
sslcert_principal_get_organization_unit_names;
struct_.struct_.get_domain_components =
sslcert_principal_get_domain_components;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,36 @@
// 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_SSLCERT_PRINCIPAL_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_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_ssl_info.h"
#include "include/capi/cef_ssl_info_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 CefSSLCertPrincipalCppToC
: public CefCppToC<CefSSLCertPrincipalCppToC, CefSSLCertPrincipal,
cef_sslcert_principal_t> {
public:
explicit CefSSLCertPrincipalCppToC(CefSSLCertPrincipal* cls);
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_

View File

@ -0,0 +1,146 @@
// 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/binary_value_cpptoc.h"
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get(
self)->GetSubject();
// Return type: refptr_same
return CefSSLCertPrincipalCppToC::Wrap(_retval);
}
cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_issuer(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get(
self)->GetIssuer();
// Return type: refptr_same
return CefSSLCertPrincipalCppToC::Wrap(_retval);
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_serial_number(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetSerialNumber();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_time_t CEF_CALLBACK sslinfo_get_valid_start(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefSSLInfoCppToC::Get(self)->GetValidStart();
// Return type: simple
return _retval;
}
cef_time_t CEF_CALLBACK sslinfo_get_valid_expiry(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefSSLInfoCppToC::Get(self)->GetValidExpiry();
// Return type: simple
return _retval;
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_derencoded(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetDEREncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_pemencoded(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetPEMEncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefSSLInfoCppToC::CefSSLInfoCppToC(CefSSLInfo* cls)
: CefCppToC<CefSSLInfoCppToC, CefSSLInfo, cef_sslinfo_t>(cls) {
struct_.struct_.get_subject = sslinfo_get_subject;
struct_.struct_.get_issuer = sslinfo_get_issuer;
struct_.struct_.get_serial_number = sslinfo_get_serial_number;
struct_.struct_.get_valid_start = sslinfo_get_valid_start;
struct_.struct_.get_valid_expiry = sslinfo_get_valid_expiry;
struct_.struct_.get_derencoded = sslinfo_get_derencoded;
struct_.struct_.get_pemencoded = sslinfo_get_pemencoded;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefSSLInfoCppToC, CefSSLInfo,
cef_sslinfo_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,35 @@
// 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_SSLINFO_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLINFO_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_ssl_info.h"
#include "include/capi/cef_ssl_info_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 CefSSLInfoCppToC
: public CefCppToC<CefSSLInfoCppToC, CefSSLInfo, cef_sslinfo_t> {
public:
explicit CefSSLInfoCppToC(CefSSLInfo* cls);
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLINFO_CPPTOC_H_