Add API for SSL status and certificate retrieval (issue #1924)

This commit is contained in:
Marshall Greenblatt
2016-09-02 13:01:33 +03:00
parent 4d1a32e028
commit 10c1fd6b8d
53 changed files with 2239 additions and 1036 deletions

View File

@ -13,6 +13,7 @@
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/download_image_callback_ctocpp.h"
@ -938,6 +939,22 @@ void CEF_CALLBACK browser_host_drag_source_system_drag_ended(
CefBrowserHostCppToC::Get(self)->DragSourceSystemDragEnded();
}
struct _cef_navigation_entry_t* CEF_CALLBACK browser_host_get_visible_navigation_entry(
struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefNavigationEntry> _retval = CefBrowserHostCppToC::Get(
self)->GetVisibleNavigationEntry();
// Return type: refptr_same
return CefNavigationEntryCppToC::Wrap(_retval);
}
} // namespace
@ -1003,6 +1020,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->drag_source_ended_at = browser_host_drag_source_ended_at;
GetStruct()->drag_source_system_drag_ended =
browser_host_drag_source_system_drag_ended;
GetStruct()->get_visible_navigation_entry =
browser_host_get_visible_navigation_entry;
}
template<> CefRefPtr<CefBrowserHost> CefCppToC<CefBrowserHostCppToC,

View File

@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/sslstatus_cpptoc.h"
namespace {
@ -153,6 +154,22 @@ int CEF_CALLBACK navigation_entry_get_http_status_code(
return _retval;
}
struct _cef_sslstatus_t* CEF_CALLBACK navigation_entry_get_sslstatus(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSSLStatus> _retval = CefNavigationEntryCppToC::Get(
self)->GetSSLStatus();
// Return type: refptr_same
return CefSSLStatusCppToC::Wrap(_retval);
}
} // namespace
@ -168,6 +185,7 @@ CefNavigationEntryCppToC::CefNavigationEntryCppToC() {
GetStruct()->has_post_data = navigation_entry_has_post_data;
GetStruct()->get_completion_time = navigation_entry_get_completion_time;
GetStruct()->get_http_status_code = navigation_entry_get_http_status_code;
GetStruct()->get_sslstatus = navigation_entry_get_sslstatus;
}
template<> CefRefPtr<CefNavigationEntry> CefCppToC<CefNavigationEntryCppToC,

View File

@ -20,6 +20,8 @@
#include "include/cef_navigation_entry.h"
#include "include/capi/cef_navigation_entry_capi.h"
#include "include/cef_ssl_status.h"
#include "include/capi/cef_ssl_status_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.

View File

@ -10,10 +10,8 @@
// for more information.
//
#include <algorithm>
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
@ -35,36 +33,7 @@ cef_cert_status_t CEF_CALLBACK sslinfo_get_cert_status(
return _retval;
}
int CEF_CALLBACK sslinfo_is_cert_status_error(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLInfoCppToC::Get(self)->IsCertStatusError();
// Return type: bool
return _retval;
}
int CEF_CALLBACK sslinfo_is_cert_status_minor_error(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLInfoCppToC::Get(self)->IsCertStatusMinorError();
// Return type: bool
return _retval;
}
cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
struct _cef_x509certificate_t* CEF_CALLBACK sslinfo_get_x509certificate(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -73,189 +42,11 @@ cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
return NULL;
// Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get(
self)->GetSubject();
CefRefPtr<CefX509Certificate> _retval = CefSSLInfoCppToC::Get(
self)->GetX509Certificate();
// 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);
}
size_t CEF_CALLBACK sslinfo_get_issuer_chain_size(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefSSLInfoCppToC::Get(self)->GetIssuerChainSize();
// Return type: simple
return _retval;
}
void CEF_CALLBACK sslinfo_get_derencoded_issuer_chain(
struct _cef_sslinfo_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefSSLInfoCppToC::Get(self)->GetDEREncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
void CEF_CALLBACK sslinfo_get_pemencoded_issuer_chain(
struct _cef_sslinfo_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefSSLInfoCppToC::Get(self)->GetPEMEncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
return CefX509CertificateCppToC::Wrap(_retval);
}
} // namespace
@ -265,20 +56,7 @@ void CEF_CALLBACK sslinfo_get_pemencoded_issuer_chain(
CefSSLInfoCppToC::CefSSLInfoCppToC() {
GetStruct()->get_cert_status = sslinfo_get_cert_status;
GetStruct()->is_cert_status_error = sslinfo_is_cert_status_error;
GetStruct()->is_cert_status_minor_error = sslinfo_is_cert_status_minor_error;
GetStruct()->get_subject = sslinfo_get_subject;
GetStruct()->get_issuer = sslinfo_get_issuer;
GetStruct()->get_serial_number = sslinfo_get_serial_number;
GetStruct()->get_valid_start = sslinfo_get_valid_start;
GetStruct()->get_valid_expiry = sslinfo_get_valid_expiry;
GetStruct()->get_derencoded = sslinfo_get_derencoded;
GetStruct()->get_pemencoded = sslinfo_get_pemencoded;
GetStruct()->get_issuer_chain_size = sslinfo_get_issuer_chain_size;
GetStruct()->get_derencoded_issuer_chain =
sslinfo_get_derencoded_issuer_chain;
GetStruct()->get_pemencoded_issuer_chain =
sslinfo_get_pemencoded_issuer_chain;
GetStruct()->get_x509certificate = sslinfo_get_x509certificate;
}
template<> CefRefPtr<CefSSLInfo> CefCppToC<CefSSLInfoCppToC, CefSSLInfo,

View File

@ -0,0 +1,122 @@
// Copyright (c) 2016 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/sslstatus_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK sslstatus_is_secure_connection(struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLStatusCppToC::Get(self)->IsSecureConnection();
// Return type: bool
return _retval;
}
cef_cert_status_t CEF_CALLBACK sslstatus_get_cert_status(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CERT_STATUS_NONE;
// Execute
cef_cert_status_t _retval = CefSSLStatusCppToC::Get(self)->GetCertStatus();
// Return type: simple
return _retval;
}
cef_ssl_version_t CEF_CALLBACK sslstatus_get_sslversion(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return SSL_CONNECTION_VERSION_UNKNOWN;
// Execute
cef_ssl_version_t _retval = CefSSLStatusCppToC::Get(self)->GetSSLVersion();
// Return type: simple
return _retval;
}
cef_ssl_content_status_t CEF_CALLBACK sslstatus_get_content_status(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return SSL_CONTENT_NORMAL_CONTENT;
// Execute
cef_ssl_content_status_t _retval = CefSSLStatusCppToC::Get(
self)->GetContentStatus();
// Return type: simple
return _retval;
}
struct _cef_x509certificate_t* CEF_CALLBACK sslstatus_get_x509certificate(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509Certificate> _retval = CefSSLStatusCppToC::Get(
self)->GetX509Certificate();
// Return type: refptr_same
return CefX509CertificateCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefSSLStatusCppToC::CefSSLStatusCppToC() {
GetStruct()->is_secure_connection = sslstatus_is_secure_connection;
GetStruct()->get_cert_status = sslstatus_get_cert_status;
GetStruct()->get_sslversion = sslstatus_get_sslversion;
GetStruct()->get_content_status = sslstatus_get_content_status;
GetStruct()->get_x509certificate = sslstatus_get_x509certificate;
}
template<> CefRefPtr<CefSSLStatus> CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::UnwrapDerived(CefWrapperType type, cef_sslstatus_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::kWrapperType = WT_SSLSTATUS;

View File

@ -0,0 +1,36 @@
// Copyright (c) 2016 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_SSLSTATUS_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLSTATUS_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_status.h"
#include "include/capi/cef_ssl_status_capi.h"
#include "include/cef_x509_certificate.h"
#include "include/capi/cef_x509_certificate_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 CefSSLStatusCppToC
: public CefCppToC<CefSSLStatusCppToC, CefSSLStatus, cef_sslstatus_t> {
public:
CefSSLStatusCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLSTATUS_CPPTOC_H_

View File

@ -10,7 +10,7 @@
// for more information.
//
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/x509cert_principal_cpptoc.h"
#include "libcef_dll/transfer_util.h"
@ -18,8 +18,8 @@ namespace {
// 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) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_display_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -27,14 +27,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetDisplayName();
CefString _retval = CefX509CertPrincipalCppToC::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) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_common_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -42,14 +42,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCommonName();
CefString _retval = CefX509CertPrincipalCppToC::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) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_locality_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -57,14 +57,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetLocalityName();
CefString _retval = CefX509CertPrincipalCppToC::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) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_state_or_province_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -72,15 +72,15 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(
CefString _retval = CefX509CertPrincipalCppToC::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) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_country_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -88,14 +88,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCountryName();
CefString _retval = CefX509CertPrincipalCppToC::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) {
void CEF_CALLBACK x509cert_principal_get_street_addresses(
struct _cef_x509cert_principal_t* self, cef_string_list_t addresses) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -111,7 +111,7 @@ void CEF_CALLBACK sslcert_principal_get_street_addresses(
transfer_string_list_contents(addresses, addressesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetStreetAddresses(
CefX509CertPrincipalCppToC::Get(self)->GetStreetAddresses(
addressesList);
// Restore param: addresses; type: string_vec_byref
@ -119,8 +119,8 @@ void CEF_CALLBACK sslcert_principal_get_street_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) {
void CEF_CALLBACK x509cert_principal_get_organization_names(
struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -136,7 +136,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_names(
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationNames(
CefX509CertPrincipalCppToC::Get(self)->GetOrganizationNames(
namesList);
// Restore param: names; type: string_vec_byref
@ -144,8 +144,8 @@ void CEF_CALLBACK sslcert_principal_get_organization_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) {
void CEF_CALLBACK x509cert_principal_get_organization_unit_names(
struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -161,7 +161,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
CefX509CertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
namesList);
// Restore param: names; type: string_vec_byref
@ -169,8 +169,8 @@ void CEF_CALLBACK sslcert_principal_get_organization_unit_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) {
void CEF_CALLBACK x509cert_principal_get_domain_components(
struct _cef_x509cert_principal_t* self, cef_string_list_t components) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -186,7 +186,7 @@ void CEF_CALLBACK sslcert_principal_get_domain_components(
transfer_string_list_contents(components, componentsList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetDomainComponents(
CefX509CertPrincipalCppToC::Get(self)->GetDomainComponents(
componentsList);
// Restore param: components; type: string_vec_byref
@ -199,33 +199,33 @@ void CEF_CALLBACK sslcert_principal_get_domain_components(
// CONSTRUCTOR - Do not edit by hand.
CefSSLCertPrincipalCppToC::CefSSLCertPrincipalCppToC() {
GetStruct()->get_display_name = sslcert_principal_get_display_name;
GetStruct()->get_common_name = sslcert_principal_get_common_name;
GetStruct()->get_locality_name = sslcert_principal_get_locality_name;
CefX509CertPrincipalCppToC::CefX509CertPrincipalCppToC() {
GetStruct()->get_display_name = x509cert_principal_get_display_name;
GetStruct()->get_common_name = x509cert_principal_get_common_name;
GetStruct()->get_locality_name = x509cert_principal_get_locality_name;
GetStruct()->get_state_or_province_name =
sslcert_principal_get_state_or_province_name;
GetStruct()->get_country_name = sslcert_principal_get_country_name;
GetStruct()->get_street_addresses = sslcert_principal_get_street_addresses;
x509cert_principal_get_state_or_province_name;
GetStruct()->get_country_name = x509cert_principal_get_country_name;
GetStruct()->get_street_addresses = x509cert_principal_get_street_addresses;
GetStruct()->get_organization_names =
sslcert_principal_get_organization_names;
x509cert_principal_get_organization_names;
GetStruct()->get_organization_unit_names =
sslcert_principal_get_organization_unit_names;
GetStruct()->get_domain_components = sslcert_principal_get_domain_components;
x509cert_principal_get_organization_unit_names;
GetStruct()->get_domain_components = x509cert_principal_get_domain_components;
}
template<> CefRefPtr<CefSSLCertPrincipal> CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::UnwrapDerived(
CefWrapperType type, cef_sslcert_principal_t* s) {
template<> CefRefPtr<CefX509CertPrincipal> CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::UnwrapDerived(
CefWrapperType type, cef_x509cert_principal_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0;
template<> base::AtomicRefCount CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::kWrapperType =
WT_SSLCERT_PRINCIPAL;
template<> CefWrapperType CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::kWrapperType =
WT_X509CERT_PRINCIPAL;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2016 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_X509CERT_PRINCIPAL_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_X509CERT_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_x509_certificate.h"
#include "include/capi/cef_x509_certificate_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 CefX509CertPrincipalCppToC
: public CefCppToC<CefX509CertPrincipalCppToC, CefX509CertPrincipal,
cef_x509cert_principal_t> {
public:
CefX509CertPrincipalCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_X509CERT_PRINCIPAL_CPPTOC_H_

View File

@ -0,0 +1,254 @@
// Copyright (c) 2016 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 <algorithm>
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
#include "libcef_dll/cpptoc/x509cert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_x509cert_principal_t* CEF_CALLBACK x509certificate_get_subject(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509CertPrincipal> _retval = CefX509CertificateCppToC::Get(
self)->GetSubject();
// Return type: refptr_same
return CefX509CertPrincipalCppToC::Wrap(_retval);
}
cef_x509cert_principal_t* CEF_CALLBACK x509certificate_get_issuer(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509CertPrincipal> _retval = CefX509CertificateCppToC::Get(
self)->GetIssuer();
// Return type: refptr_same
return CefX509CertPrincipalCppToC::Wrap(_retval);
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_serial_number(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetSerialNumber();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_time_t CEF_CALLBACK x509certificate_get_valid_start(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefX509CertificateCppToC::Get(self)->GetValidStart();
// Return type: simple
return _retval;
}
cef_time_t CEF_CALLBACK x509certificate_get_valid_expiry(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefX509CertificateCppToC::Get(self)->GetValidExpiry();
// Return type: simple
return _retval;
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_derencoded(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetDEREncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_pemencoded(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetPEMEncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
size_t CEF_CALLBACK x509certificate_get_issuer_chain_size(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefX509CertificateCppToC::Get(self)->GetIssuerChainSize();
// Return type: simple
return _retval;
}
void CEF_CALLBACK x509certificate_get_derencoded_issuer_chain(
struct _cef_x509certificate_t* self, size_t* chainCount,
cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefX509CertificateCppToC::Get(self)->GetDEREncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
void CEF_CALLBACK x509certificate_get_pemencoded_issuer_chain(
struct _cef_x509certificate_t* self, size_t* chainCount,
cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefX509CertificateCppToC::Get(self)->GetPEMEncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefX509CertificateCppToC::CefX509CertificateCppToC() {
GetStruct()->get_subject = x509certificate_get_subject;
GetStruct()->get_issuer = x509certificate_get_issuer;
GetStruct()->get_serial_number = x509certificate_get_serial_number;
GetStruct()->get_valid_start = x509certificate_get_valid_start;
GetStruct()->get_valid_expiry = x509certificate_get_valid_expiry;
GetStruct()->get_derencoded = x509certificate_get_derencoded;
GetStruct()->get_pemencoded = x509certificate_get_pemencoded;
GetStruct()->get_issuer_chain_size = x509certificate_get_issuer_chain_size;
GetStruct()->get_derencoded_issuer_chain =
x509certificate_get_derencoded_issuer_chain;
GetStruct()->get_pemencoded_issuer_chain =
x509certificate_get_pemencoded_issuer_chain;
}
template<> CefRefPtr<CefX509Certificate> CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::UnwrapDerived(
CefWrapperType type, cef_x509certificate_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::kWrapperType =
WT_X509CERTIFICATE;

View File

@ -10,26 +10,26 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_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 "include/cef_x509_certificate.h"
#include "include/capi/cef_x509_certificate_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> {
class CefX509CertificateCppToC
: public CefCppToC<CefX509CertificateCppToC, CefX509Certificate,
cef_x509certificate_t> {
public:
CefSSLCertPrincipalCppToC();
CefX509CertificateCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_CPPTOC_H_