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

@ -380,12 +380,12 @@ static_library("libcef_static") {
"libcef/browser/scheme_impl.cc", "libcef/browser/scheme_impl.cc",
"libcef/browser/speech_recognition_manager_delegate.cc", "libcef/browser/speech_recognition_manager_delegate.cc",
"libcef/browser/speech_recognition_manager_delegate.h", "libcef/browser/speech_recognition_manager_delegate.h",
"libcef/browser/ssl_cert_principal_impl.cc",
"libcef/browser/ssl_cert_principal_impl.h",
"libcef/browser/ssl_host_state_delegate.cc", "libcef/browser/ssl_host_state_delegate.cc",
"libcef/browser/ssl_host_state_delegate.h", "libcef/browser/ssl_host_state_delegate.h",
"libcef/browser/ssl_info_impl.cc", "libcef/browser/ssl_info_impl.cc",
"libcef/browser/ssl_info_impl.h", "libcef/browser/ssl_info_impl.h",
"libcef/browser/ssl_status_impl.cc",
"libcef/browser/ssl_status_impl.h",
"libcef/browser/storage_partition_proxy.cc", "libcef/browser/storage_partition_proxy.cc",
"libcef/browser/storage_partition_proxy.h", "libcef/browser/storage_partition_proxy.h",
"libcef/browser/stream_impl.cc", "libcef/browser/stream_impl.cc",
@ -396,6 +396,10 @@ static_library("libcef_static") {
"libcef/browser/thread_util.h", "libcef/browser/thread_util.h",
"libcef/browser/web_plugin_impl.cc", "libcef/browser/web_plugin_impl.cc",
"libcef/browser/web_plugin_impl.h", "libcef/browser/web_plugin_impl.h",
"libcef/browser/x509_certificate_impl.cc",
"libcef/browser/x509_certificate_impl.h",
"libcef/browser/x509_cert_principal_impl.cc",
"libcef/browser/x509_cert_principal_impl.h",
"libcef/browser/xml_reader_impl.cc", "libcef/browser/xml_reader_impl.cc",
"libcef/browser/xml_reader_impl.h", "libcef/browser/xml_reader_impl.h",
"libcef/browser/zip_reader_impl.cc", "libcef/browser/zip_reader_impl.cc",

View File

@ -61,6 +61,7 @@
'include/cef_response_filter.h', 'include/cef_response_filter.h',
'include/cef_scheme.h', 'include/cef_scheme.h',
'include/cef_ssl_info.h', 'include/cef_ssl_info.h',
'include/cef_ssl_status.h',
'include/cef_stream.h', 'include/cef_stream.h',
'include/cef_string_visitor.h', 'include/cef_string_visitor.h',
'include/cef_task.h', 'include/cef_task.h',
@ -69,6 +70,7 @@
'include/cef_v8.h', 'include/cef_v8.h',
'include/cef_values.h', 'include/cef_values.h',
'include/cef_web_plugin.h', 'include/cef_web_plugin.h',
'include/cef_x509_certificate.h',
'include/cef_xml_reader.h', 'include/cef_xml_reader.h',
'include/cef_zip_reader.h', 'include/cef_zip_reader.h',
'include/test/cef_translator_test.h', 'include/test/cef_translator_test.h',
@ -143,6 +145,7 @@
'include/capi/cef_response_filter_capi.h', 'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h', 'include/capi/cef_scheme_capi.h',
'include/capi/cef_ssl_info_capi.h', 'include/capi/cef_ssl_info_capi.h',
'include/capi/cef_ssl_status_capi.h',
'include/capi/cef_stream_capi.h', 'include/capi/cef_stream_capi.h',
'include/capi/cef_string_visitor_capi.h', 'include/capi/cef_string_visitor_capi.h',
'include/capi/cef_task_capi.h', 'include/capi/cef_task_capi.h',
@ -151,6 +154,7 @@
'include/capi/cef_v8_capi.h', 'include/capi/cef_v8_capi.h',
'include/capi/cef_values_capi.h', 'include/capi/cef_values_capi.h',
'include/capi/cef_web_plugin_capi.h', 'include/capi/cef_web_plugin_capi.h',
'include/capi/cef_x509_certificate_capi.h',
'include/capi/cef_xml_reader_capi.h', 'include/capi/cef_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h', 'include/capi/cef_zip_reader_capi.h',
'include/capi/test/cef_translator_test_capi.h', 'include/capi/test/cef_translator_test_capi.h',
@ -344,10 +348,10 @@
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h', 'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h', 'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/sslcert_principal_cpptoc.cc',
'libcef_dll/cpptoc/sslcert_principal_cpptoc.h',
'libcef_dll/cpptoc/sslinfo_cpptoc.cc', 'libcef_dll/cpptoc/sslinfo_cpptoc.cc',
'libcef_dll/cpptoc/sslinfo_cpptoc.h', 'libcef_dll/cpptoc/sslinfo_cpptoc.h',
'libcef_dll/cpptoc/sslstatus_cpptoc.cc',
'libcef_dll/cpptoc/sslstatus_cpptoc.h',
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc', 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h', 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc', 'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
@ -418,6 +422,10 @@
'libcef_dll/ctocpp/views/window_delegate_ctocpp.h', 'libcef_dll/ctocpp/views/window_delegate_ctocpp.h',
'libcef_dll/ctocpp/write_handler_ctocpp.cc', 'libcef_dll/ctocpp/write_handler_ctocpp.cc',
'libcef_dll/ctocpp/write_handler_ctocpp.h', 'libcef_dll/ctocpp/write_handler_ctocpp.h',
'libcef_dll/cpptoc/x509cert_principal_cpptoc.cc',
'libcef_dll/cpptoc/x509cert_principal_cpptoc.h',
'libcef_dll/cpptoc/x509certificate_cpptoc.cc',
'libcef_dll/cpptoc/x509certificate_cpptoc.h',
'libcef_dll/cpptoc/xml_reader_cpptoc.cc', 'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
'libcef_dll/cpptoc/xml_reader_cpptoc.h', 'libcef_dll/cpptoc/xml_reader_cpptoc.h',
'libcef_dll/cpptoc/zip_reader_cpptoc.cc', 'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
@ -592,10 +600,10 @@
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h', 'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h', 'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/sslcert_principal_ctocpp.cc',
'libcef_dll/ctocpp/sslcert_principal_ctocpp.h',
'libcef_dll/ctocpp/sslinfo_ctocpp.cc', 'libcef_dll/ctocpp/sslinfo_ctocpp.cc',
'libcef_dll/ctocpp/sslinfo_ctocpp.h', 'libcef_dll/ctocpp/sslinfo_ctocpp.h',
'libcef_dll/ctocpp/sslstatus_ctocpp.cc',
'libcef_dll/ctocpp/sslstatus_ctocpp.h',
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc', 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h', 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc', 'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
@ -666,6 +674,10 @@
'libcef_dll/cpptoc/views/window_delegate_cpptoc.h', 'libcef_dll/cpptoc/views/window_delegate_cpptoc.h',
'libcef_dll/cpptoc/write_handler_cpptoc.cc', 'libcef_dll/cpptoc/write_handler_cpptoc.cc',
'libcef_dll/cpptoc/write_handler_cpptoc.h', 'libcef_dll/cpptoc/write_handler_cpptoc.h',
'libcef_dll/ctocpp/x509cert_principal_ctocpp.cc',
'libcef_dll/ctocpp/x509cert_principal_ctocpp.h',
'libcef_dll/ctocpp/x509certificate_ctocpp.cc',
'libcef_dll/ctocpp/x509certificate_ctocpp.h',
'libcef_dll/ctocpp/xml_reader_ctocpp.cc', 'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
'libcef_dll/ctocpp/xml_reader_ctocpp.h', 'libcef_dll/ctocpp/xml_reader_ctocpp.h',
'libcef_dll/ctocpp/zip_reader_ctocpp.cc', 'libcef_dll/ctocpp/zip_reader_ctocpp.cc',

View File

@ -700,6 +700,13 @@ typedef struct _cef_browser_host_t {
/// ///
void (CEF_CALLBACK *drag_source_system_drag_ended)( void (CEF_CALLBACK *drag_source_system_drag_ended)(
struct _cef_browser_host_t* self); struct _cef_browser_host_t* self);
///
// Returns the current visible navigation entry for this browser. This
// function can only be called on the UI thread.
///
struct _cef_navigation_entry_t* (CEF_CALLBACK *get_visible_navigation_entry)(
struct _cef_browser_host_t* self);
} cef_browser_host_t; } cef_browser_host_t;

View File

@ -102,7 +102,7 @@ typedef struct _cef_life_span_handler_t {
// has been fired. // has been fired.
// //
// An application should handle top-level owner window close notifications by // An application should handle top-level owner window close notifications by
// calling cef_browser_host_t::Tryclose_browser() or // calling cef_browser_host_t::try_close_browser() or
// cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window // cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
// to close immediately (see the examples below). This gives CEF an // to close immediately (see the examples below). This gives CEF an
// opportunity to process the 'onbeforeunload' event and optionally cancel the // opportunity to process the 'onbeforeunload' event and optionally cancel the
@ -132,7 +132,7 @@ typedef struct _cef_life_span_handler_t {
// The below examples describe what should happen during window close when the // The below examples describe what should happen during window close when the
// browser is parented to an application-provided top-level window. // browser is parented to an application-provided top-level window.
// //
// Example 1: Using cef_browser_host_t::Tryclose_browser(). This is // Example 1: Using cef_browser_host_t::try_close_browser(). This is
// recommended for clients using standard close handling and windows created // recommended for clients using standard close handling and windows created
// on the browser process UI thread. 1. User clicks the window close button // on the browser process UI thread. 1. User clicks the window close button
// which sends a close notification to // which sends a close notification to

View File

@ -44,6 +44,7 @@
extern "C" { extern "C" {
#endif #endif
struct _cef_sslstatus_t;
/// ///
// Structure used to represent an entry in navigation history. // Structure used to represent an entry in navigation history.
@ -116,6 +117,12 @@ typedef struct _cef_navigation_entry_t {
/// ///
int (CEF_CALLBACK *get_http_status_code)( int (CEF_CALLBACK *get_http_status_code)(
struct _cef_navigation_entry_t* self); struct _cef_navigation_entry_t* self);
///
// Returns the SSL information for this navigation entry.
///
struct _cef_sslstatus_t* (CEF_CALLBACK *get_sslstatus)(
struct _cef_navigation_entry_t* self);
} cef_navigation_entry_t; } cef_navigation_entry_t;

View File

@ -40,83 +40,13 @@
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h" #include "include/capi/cef_values_capi.h"
#include "include/capi/cef_x509_certificate_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
///
// Structure representing the issuer or subject field of an X.509 certificate.
///
typedef struct _cef_sslcert_principal_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: CN, O and OU and returns the first non-NULL one found.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_display_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the common name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_common_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the locality name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_locality_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the state or province name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_state_or_province_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the country name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_country_name)(
struct _cef_sslcert_principal_t* self);
///
// Retrieve the list of street addresses.
///
void (CEF_CALLBACK *get_street_addresses)(
struct _cef_sslcert_principal_t* self, cef_string_list_t addresses);
///
// Retrieve the list of organization names.
///
void (CEF_CALLBACK *get_organization_names)(
struct _cef_sslcert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of organization unit names.
///
void (CEF_CALLBACK *get_organization_unit_names)(
struct _cef_sslcert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of domain components.
///
void (CEF_CALLBACK *get_domain_components)(
struct _cef_sslcert_principal_t* self, cef_string_list_t components);
} cef_sslcert_principal_t;
/// ///
// Structure representing SSL information. // Structure representing SSL information.
/// ///
@ -134,85 +64,24 @@ typedef struct _cef_sslinfo_t {
struct _cef_sslinfo_t* self); struct _cef_sslinfo_t* self);
/// ///
// Returns true (1) if the certificate status has any error, major or minor. // Returns the X.509 certificate.
/// ///
int (CEF_CALLBACK *is_cert_status_error)(struct _cef_sslinfo_t* self); struct _cef_x509certificate_t* (CEF_CALLBACK *get_x509certificate)(
///
// Returns true (1) if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
int (CEF_CALLBACK *is_cert_status_minor_error)(struct _cef_sslinfo_t* self);
///
// Returns the subject of the X.509 certificate. For HTTPS server certificates
// this represents the web server. The common name of the subject should
// match the host name of the web server.
///
struct _cef_sslcert_principal_t* (CEF_CALLBACK *get_subject)(
struct _cef_sslinfo_t* self); struct _cef_sslinfo_t* self);
///
// Returns the issuer of the X.509 certificate.
///
struct _cef_sslcert_principal_t* (CEF_CALLBACK *get_issuer)(
struct _cef_sslinfo_t* self);
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_serial_number)(
struct _cef_sslinfo_t* self);
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_start)(struct _cef_sslinfo_t* self);
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_expiry)(struct _cef_sslinfo_t* self);
///
// Returns the DER encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_derencoded)(
struct _cef_sslinfo_t* self);
///
// Returns the PEM encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
struct _cef_sslinfo_t* self);
///
// Returns the number of certificates in the issuer chain. If 0, the
// certificate is self-signed.
///
size_t (CEF_CALLBACK *get_issuer_chain_size)(struct _cef_sslinfo_t* self);
///
// Returns the DER encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_derencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
///
// Returns the PEM encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
} cef_sslinfo_t; } cef_sslinfo_t;
///
// Returns true (1) if the certificate status has any error, major or minor.
///
CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status);
///
// Returns true (1) if the certificate status represents only minor errors (e.g.
// failure to verify certificate revocation).
///
CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -0,0 +1,95 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_x509certificate_t;
///
// Structure representing the SSL information for a navigation entry.
///
typedef struct _cef_sslstatus_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns true (1) if the status is related to a secure SSL/TLS connection.
///
int (CEF_CALLBACK *is_secure_connection)(struct _cef_sslstatus_t* self);
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
cef_cert_status_t (CEF_CALLBACK *get_cert_status)(
struct _cef_sslstatus_t* self);
///
// Returns the SSL version used for the SSL connection.
///
cef_ssl_version_t (CEF_CALLBACK *get_sslversion)(
struct _cef_sslstatus_t* self);
///
// Returns a bitmask containing the page security content status.
///
cef_ssl_content_status_t (CEF_CALLBACK *get_content_status)(
struct _cef_sslstatus_t* self);
///
// Returns the X.509 certificate.
///
struct _cef_x509certificate_t* (CEF_CALLBACK *get_x509certificate)(
struct _cef_sslstatus_t* self);
} cef_sslstatus_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_

View File

@ -0,0 +1,208 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure representing the issuer or subject field of an X.509 certificate.
///
typedef struct _cef_x509cert_principal_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: Common Name (CN), Organization Name (O) and Organizational Unit Name
// (OU) and returns the first non-NULL one found.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_display_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the common name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_common_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the locality name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_locality_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the state or province name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_state_or_province_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the country name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_country_name)(
struct _cef_x509cert_principal_t* self);
///
// Retrieve the list of street addresses.
///
void (CEF_CALLBACK *get_street_addresses)(
struct _cef_x509cert_principal_t* self, cef_string_list_t addresses);
///
// Retrieve the list of organization names.
///
void (CEF_CALLBACK *get_organization_names)(
struct _cef_x509cert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of organization unit names.
///
void (CEF_CALLBACK *get_organization_unit_names)(
struct _cef_x509cert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of domain components.
///
void (CEF_CALLBACK *get_domain_components)(
struct _cef_x509cert_principal_t* self, cef_string_list_t components);
} cef_x509cert_principal_t;
///
// Structure representing a X.509 certificate.
///
typedef struct _cef_x509certificate_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the subject of the X.509 certificate. For HTTPS server certificates
// this represents the web server. The common name of the subject should
// match the host name of the web server.
///
struct _cef_x509cert_principal_t* (CEF_CALLBACK *get_subject)(
struct _cef_x509certificate_t* self);
///
// Returns the issuer of the X.509 certificate.
///
struct _cef_x509cert_principal_t* (CEF_CALLBACK *get_issuer)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_serial_number)(
struct _cef_x509certificate_t* self);
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_start)(
struct _cef_x509certificate_t* self);
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_expiry)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_derencoded)(
struct _cef_x509certificate_t* self);
///
// Returns the PEM encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
struct _cef_x509certificate_t* self);
///
// Returns the number of certificates in the issuer chain. If 0, the
// certificate is self-signed.
///
size_t (CEF_CALLBACK *get_issuer_chain_size)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_derencoded_issuer_chain)(
struct _cef_x509certificate_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain);
///
// Returns the PEM encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(
struct _cef_x509certificate_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain);
} cef_x509certificate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_

View File

@ -753,6 +753,13 @@ class CefBrowserHost : public virtual CefBase {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void DragSourceSystemDragEnded() =0; virtual void DragSourceSystemDragEnded() =0;
///
// Returns the current visible navigation entry for this browser. This method
// can only be called on the UI thread.
///
/*--cef()--*/
virtual CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() =0;
}; };
#endif // CEF_INCLUDE_CEF_BROWSER_H_ #endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@ -40,6 +40,8 @@
#include "include/cef_base.h" #include "include/cef_base.h"
class CefSSLStatus;
/// ///
// Class used to represent an entry in navigation history. // Class used to represent an entry in navigation history.
/// ///
@ -108,6 +110,12 @@ class CefNavigationEntry : public virtual CefBase {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual int GetHttpStatusCode() =0; virtual int GetHttpStatusCode() =0;
///
// Returns the SSL information for this navigation entry.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLStatus> GetSSLStatus() =0;
}; };
#endif // CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_ #endif // CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_

View File

@ -38,72 +38,10 @@
#define CEF_INCLUDE_CEF_SSL_INFO_H_ #define CEF_INCLUDE_CEF_SSL_INFO_H_
#pragma once #pragma once
#include <vector>
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_values.h" #include "include/cef_values.h"
/// #include "include/cef_x509_certificate.h"
// Class representing the issuer or subject field of an X.509 certificate.
///
/*--cef(source=library)--*/
class CefSSLCertPrincipal : public virtual CefBase {
public:
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: CN, O and OU and returns the first non-empty one found.
///
/*--cef()--*/
virtual CefString GetDisplayName() =0;
///
// Returns the common name.
///
/*--cef()--*/
virtual CefString GetCommonName() =0;
///
// Returns the locality name.
///
/*--cef()--*/
virtual CefString GetLocalityName() =0;
///
// Returns the state or province name.
///
/*--cef()--*/
virtual CefString GetStateOrProvinceName() =0;
///
// Returns the country name.
///
/*--cef()--*/
virtual CefString GetCountryName() =0;
///
// Retrieve the list of street addresses.
///
/*--cef()--*/
virtual void GetStreetAddresses(std::vector<CefString>& addresses) =0;
///
// Retrieve the list of organization names.
///
/*--cef()--*/
virtual void GetOrganizationNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of organization unit names.
///
/*--cef()--*/
virtual void GetOrganizationUnitNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of domain components.
///
/*--cef()--*/
virtual void GetDomainComponents(std::vector<CefString>& components) =0;
};
/// ///
// Class representing SSL information. // Class representing SSL information.
@ -111,8 +49,6 @@ class CefSSLCertPrincipal : public virtual CefBase {
/*--cef(source=library)--*/ /*--cef(source=library)--*/
class CefSSLInfo : public virtual CefBase { class CefSSLInfo : public virtual CefBase {
public: public:
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
/// ///
// Returns a bitmask containing any and all problems verifying the server // Returns a bitmask containing any and all problems verifying the server
// certificate. // certificate.
@ -120,88 +56,25 @@ class CefSSLInfo : public virtual CefBase {
/*--cef(default_retval=CERT_STATUS_NONE)--*/ /*--cef(default_retval=CERT_STATUS_NONE)--*/
virtual cef_cert_status_t GetCertStatus() =0; virtual cef_cert_status_t GetCertStatus() =0;
///
// Returns the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefX509Certificate> GetX509Certificate() =0;
};
/// ///
// Returns true if the certificate status has any error, major or minor. // Returns true if the certificate status has any error, major or minor.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool IsCertStatusError() =0; bool CefIsCertStatusError(cef_cert_status_t status);
/// ///
// Returns true if the certificate status represents only minor errors // Returns true if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation). // (e.g. failure to verify certificate revocation).
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool IsCertStatusMinorError() =0; bool CefIsCertStatusMinorError(cef_cert_status_t status);
///
// Returns the subject of the X.509 certificate. For HTTPS server
// certificates this represents the web server. The common name of the
// subject should match the host name of the web server.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLCertPrincipal> GetSubject() =0;
///
// Returns the issuer of the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLCertPrincipal> GetIssuer() =0;
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetSerialNumber() =0;
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidStart() =0;
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidExpiry() =0;
///
// Returns the DER encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetDEREncoded() =0;
///
// Returns the PEM encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
///
// Returns the number of certificates in the issuer chain.
// If 0, the certificate is self-signed.
///
/*--cef()--*/
virtual size_t GetIssuerChainSize() =0;
///
// Returns the DER encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
///
// Returns the PEM encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
};
#endif // CEF_INCLUDE_CEF_SSL_INFO_H_ #endif // CEF_INCLUDE_CEF_SSL_INFO_H_

84
include/cef_ssl_status.h Normal file
View File

@ -0,0 +1,84 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_SSL_STATUS_H_
#define CEF_INCLUDE_CEF_SSL_STATUS_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_values.h"
class CefX509Certificate;
///
// Class representing the SSL information for a navigation entry.
///
/*--cef(source=library)--*/
class CefSSLStatus : public virtual CefBase {
public:
///
// Returns true if the status is related to a secure SSL/TLS connection.
///
/*--cef()--*/
virtual bool IsSecureConnection() =0;
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
/*--cef(default_retval=CERT_STATUS_NONE)--*/
virtual cef_cert_status_t GetCertStatus() =0;
///
// Returns the SSL version used for the SSL connection.
///
/*--cef(default_retval=SSL_CONNECTION_VERSION_UNKNOWN)--*/
virtual cef_ssl_version_t GetSSLVersion() =0;
///
// Returns a bitmask containing the page security content status.
///
/*--cef(default_retval=SSL_CONTENT_NORMAL_CONTENT)--*/
virtual cef_ssl_content_status_t GetContentStatus() =0;
///
// Returns the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefX509Certificate> GetX509Certificate() =0;
};
#endif // CEF_INCLUDE_CEF_SSL_STATUS_H_

View File

@ -0,0 +1,188 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_X509_CERTIFICATE_H_
#define CEF_INCLUDE_CEF_X509_CERTIFICATE_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_values.h"
///
// Class representing the issuer or subject field of an X.509 certificate.
///
/*--cef(source=library)--*/
class CefX509CertPrincipal : public virtual CefBase {
public:
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: Common Name (CN), Organization Name (O) and Organizational Unit
// Name (OU) and returns the first non-empty one found.
///
/*--cef()--*/
virtual CefString GetDisplayName() =0;
///
// Returns the common name.
///
/*--cef()--*/
virtual CefString GetCommonName() =0;
///
// Returns the locality name.
///
/*--cef()--*/
virtual CefString GetLocalityName() =0;
///
// Returns the state or province name.
///
/*--cef()--*/
virtual CefString GetStateOrProvinceName() =0;
///
// Returns the country name.
///
/*--cef()--*/
virtual CefString GetCountryName() =0;
///
// Retrieve the list of street addresses.
///
/*--cef()--*/
virtual void GetStreetAddresses(std::vector<CefString>& addresses) =0;
///
// Retrieve the list of organization names.
///
/*--cef()--*/
virtual void GetOrganizationNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of organization unit names.
///
/*--cef()--*/
virtual void GetOrganizationUnitNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of domain components.
///
/*--cef()--*/
virtual void GetDomainComponents(std::vector<CefString>& components) =0;
};
///
// Class representing a X.509 certificate.
///
/*--cef(source=library)--*/
class CefX509Certificate : public virtual CefBase {
public:
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
///
// Returns the subject of the X.509 certificate. For HTTPS server
// certificates this represents the web server. The common name of the
// subject should match the host name of the web server.
///
/*--cef()--*/
virtual CefRefPtr<CefX509CertPrincipal> GetSubject() =0;
///
// Returns the issuer of the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefX509CertPrincipal> GetIssuer() =0;
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetSerialNumber() =0;
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidStart() =0;
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidExpiry() =0;
///
// Returns the DER encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetDEREncoded() =0;
///
// Returns the PEM encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
///
// Returns the number of certificates in the issuer chain.
// If 0, the certificate is self-signed.
///
/*--cef()--*/
virtual size_t GetIssuerChainSize() =0;
///
// Returns the DER encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
///
// Returns the PEM encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
};
#endif // CEF_INCLUDE_CEF_X509_CERTIFICATE_H_

View File

@ -2636,6 +2636,27 @@ typedef enum {
CEF_MENU_ANCHOR_BOTTOMCENTER, CEF_MENU_ANCHOR_BOTTOMCENTER,
} cef_menu_anchor_position_t; } cef_menu_anchor_position_t;
// Supported SSL version values. See net/ssl/ssl_connection_status_flags.h
// for more information.
typedef enum {
SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version.
SSL_CONNECTION_VERSION_SSL2 = 1,
SSL_CONNECTION_VERSION_SSL3 = 2,
SSL_CONNECTION_VERSION_TLS1 = 3,
SSL_CONNECTION_VERSION_TLS1_1 = 4,
SSL_CONNECTION_VERSION_TLS1_2 = 5,
// Reserve 6 for TLS 1.3.
SSL_CONNECTION_VERSION_QUIC = 7,
} cef_ssl_version_t;
// Supported SSL content status flags. See content/public/common/ssl_status.h
// for more information.
typedef enum {
SSL_CONTENT_NORMAL_CONTENT = 0,
SSL_CONTENT_DISPLAYED_INSECURE_CONTENT = 1 << 0,
SSL_CONTENT_RAN_INSECURE_CONTENT = 1 << 1,
} cef_ssl_content_status_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -893,6 +893,22 @@ void CefBrowserHostImpl::GetNavigationEntries(
} }
} }
CefRefPtr<CefNavigationEntry> CefBrowserHostImpl::GetVisibleNavigationEntry() {
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return nullptr;
}
content::NavigationEntry* entry = nullptr;
if (web_contents())
entry = web_contents()->GetController().GetVisibleEntry();
if (!entry)
return nullptr;
return new CefNavigationEntryImpl(entry);
}
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) { void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_); base::AutoLock lock_scope(state_lock_);
mouse_cursor_change_disabled_ = disabled; mouse_cursor_change_disabled_ = disabled;

View File

@ -218,6 +218,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DragTargetDrop(const CefMouseEvent& event) override; void DragTargetDrop(const CefMouseEvent& event) override;
void DragSourceSystemDragEnded() override; void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override; void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
// CefBrowser methods. // CefBrowser methods.
CefRefPtr<CefBrowserHost> GetHost() override; CefRefPtr<CefBrowserHost> GetHost() override;

View File

@ -4,6 +4,7 @@
#include "libcef/browser/navigation_entry_impl.h" #include "libcef/browser/navigation_entry_impl.h"
#include "libcef/browser/ssl_status_impl.h"
#include "libcef/common/time_util.h" #include "libcef/common/time_util.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
@ -62,3 +63,9 @@ int CefNavigationEntryImpl::GetHttpStatusCode() {
CEF_VALUE_VERIFY_RETURN(false, 0); CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().GetHttpStatusCode(); return const_value().GetHttpStatusCode();
} }
CefRefPtr<CefSSLStatus> CefNavigationEntryImpl::GetSSLStatus() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return new CefSSLStatusImpl(const_value().GetSSL());
}

View File

@ -29,6 +29,7 @@ class CefNavigationEntryImpl
bool HasPostData() override; bool HasPostData() override;
CefTime GetCompletionTime() override; CefTime GetCompletionTime() override;
int GetHttpStatusCode() override; int GetHttpStatusCode() override;
CefRefPtr<CefSSLStatus> GetSSLStatus() override;
private: private:
DISALLOW_COPY_AND_ASSIGN(CefNavigationEntryImpl); DISALLOW_COPY_AND_ASSIGN(CefNavigationEntryImpl);

View File

@ -3,68 +3,15 @@
// can be found in the LICENSE file. // can be found in the LICENSE file.
#include "libcef/browser/ssl_info_impl.h" #include "libcef/browser/ssl_info_impl.h"
#include "libcef/browser/ssl_cert_principal_impl.h" #include "libcef/browser/x509_certificate_impl.h"
#include "libcef/common/time_util.h"
#include "net/cert/cert_status_flags.h" #include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
namespace {
void EncodeCertificate(
const net::X509Certificate::OSCertHandle& os_handle,
CefRefPtr<CefBinaryValue>& der_encoded,
CefRefPtr<CefBinaryValue>& pem_encoded) {
std::string encoded;
if (net::X509Certificate::GetDEREncoded(os_handle, &encoded)) {
der_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
encoded.clear();
if (net::X509Certificate::GetPEMEncoded(os_handle, &encoded)) {
pem_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
}
} // namespace
CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value) CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value)
: cert_status_(CERT_STATUS_NONE) { : cert_status_(CERT_STATUS_NONE) {
if (value.cert.get()) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status); cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
if (value.cert.get()) {
subject_ = new CefSSLCertPrincipalImpl(value.cert->subject()); cert_ = new CefX509CertificateImpl(*value.cert);
issuer_ = new CefSSLCertPrincipalImpl(value.cert->issuer());
const std::string& serial_number = value.cert->serial_number();
serial_number_ = CefBinaryValue::Create(serial_number.c_str(),
serial_number.size());
const base::Time& valid_start = value.cert->valid_start();
if (!valid_start.is_null())
cef_time_from_basetime(valid_start, valid_start_);
const base::Time& valid_expiry = value.cert->valid_expiry();
if (!valid_expiry.is_null())
cef_time_from_basetime(valid_expiry, valid_expiry_);
net::X509Certificate::OSCertHandle os_handle = value.cert->os_cert_handle();
if (os_handle)
EncodeCertificate(os_handle, der_encoded_, pem_encoded_);
const net::X509Certificate::OSCertHandles& issuer_chain =
value.cert->GetIntermediateCertificates();
for (net::X509Certificate::OSCertHandles::const_iterator it =
issuer_chain.begin(); it != issuer_chain.end(); it++) {
CefRefPtr<CefBinaryValue> der_encoded, pem_encoded;
EncodeCertificate(*it, der_encoded, pem_encoded);
// Add each to the chain, even if one conversion unexpectedly failed.
// GetIssuerChainSize depends on these being the same length.
der_encoded_issuer_chain_.push_back(der_encoded);
pem_encoded_issuer_chain_.push_back(pem_encoded);
}
} }
} }
@ -72,52 +19,14 @@ cef_cert_status_t CefSSLInfoImpl::GetCertStatus() {
return cert_status_; return cert_status_;
} }
bool CefSSLInfoImpl::IsCertStatusError() { CefRefPtr<CefX509Certificate> CefSSLInfoImpl::GetX509Certificate() {
return net::IsCertStatusError(cert_status_); return cert_;
} }
bool CefSSLInfoImpl::IsCertStatusMinorError() { bool CefIsCertStatusError(cef_cert_status_t status) {
return net::IsCertStatusMinorError(cert_status_); return net::IsCertStatusError(status);
} }
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetSubject() { bool CefIsCertStatusMinorError(cef_cert_status_t status) {
return subject_; return net::IsCertStatusMinorError(status);
}
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetIssuer() {
return issuer_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetSerialNumber() {
return serial_number_;
}
CefTime CefSSLInfoImpl::GetValidStart() {
return valid_start_;
}
CefTime CefSSLInfoImpl::GetValidExpiry() {
return valid_expiry_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetDEREncoded() {
return der_encoded_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetPEMEncoded() {
return pem_encoded_;
}
size_t CefSSLInfoImpl::GetIssuerChainSize() {
return der_encoded_issuer_chain_.size();
}
void CefSSLInfoImpl::GetDEREncodedIssuerChain(
CefSSLInfo::IssuerChainBinaryList& chain) {
chain = der_encoded_issuer_chain_;
}
void CefSSLInfoImpl::GetPEMEncodedIssuerChain(
CefSSLInfo::IssuerChainBinaryList& chain) {
chain = pem_encoded_issuer_chain_;
} }

View File

@ -17,30 +17,11 @@ class CefSSLInfoImpl : public CefSSLInfo {
// CefSSLInfo methods. // CefSSLInfo methods.
cef_cert_status_t GetCertStatus() override; cef_cert_status_t GetCertStatus() override;
bool IsCertStatusError() override; CefRefPtr<CefX509Certificate> GetX509Certificate() override;
bool IsCertStatusMinorError() override;
CefRefPtr<CefSSLCertPrincipal> GetSubject() override;
CefRefPtr<CefSSLCertPrincipal> GetIssuer() override;
CefRefPtr<CefBinaryValue> GetSerialNumber() override;
CefTime GetValidStart() override;
CefTime GetValidExpiry() override;
CefRefPtr<CefBinaryValue> GetDEREncoded() override;
CefRefPtr<CefBinaryValue> GetPEMEncoded() override;
size_t GetIssuerChainSize() override;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) override;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
private: private:
cef_cert_status_t cert_status_; cef_cert_status_t cert_status_;
CefRefPtr<CefSSLCertPrincipal> subject_; CefRefPtr<CefX509Certificate> cert_;
CefRefPtr<CefSSLCertPrincipal> issuer_;
CefRefPtr<CefBinaryValue> serial_number_;
CefTime valid_start_;
CefTime valid_expiry_;
CefRefPtr<CefBinaryValue> der_encoded_;
CefRefPtr<CefBinaryValue> pem_encoded_;
IssuerChainBinaryList der_encoded_issuer_chain_;
IssuerChainBinaryList pem_encoded_issuer_chain_;
IMPLEMENT_REFCOUNTING(CefSSLInfoImpl); IMPLEMENT_REFCOUNTING(CefSSLInfoImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLInfoImpl); DISALLOW_COPY_AND_ASSIGN(CefSSLInfoImpl);

View File

@ -0,0 +1,45 @@
// 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.
#include "libcef/browser/ssl_status_impl.h"
#include "libcef/browser/x509_certificate_impl.h"
#include "content/public/browser/cert_store.h"
#include "net/ssl/ssl_connection_status_flags.h"
CefSSLStatusImpl::CefSSLStatusImpl(const content::SSLStatus& value) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
content_status_ = static_cast<cef_ssl_content_status_t>(value.content_status);
ssl_version_ = static_cast<cef_ssl_version_t>(
net::SSLConnectionStatusToVersion(value.connection_status));
cert_id_ = value.cert_id;
}
bool CefSSLStatusImpl::IsSecureConnection() {
// Secure connection if there was a certificate ID in SSLStatus.
return (cert_id_ != 0);
}
cef_cert_status_t CefSSLStatusImpl::GetCertStatus() {
return cert_status_;
}
cef_ssl_version_t CefSSLStatusImpl::GetSSLVersion() {
return ssl_version_;
}
cef_ssl_content_status_t CefSSLStatusImpl::GetContentStatus() {
return content_status_;
}
CefRefPtr<CefX509Certificate> CefSSLStatusImpl::GetX509Certificate() {
if (cert_id_) {
scoped_refptr<net::X509Certificate> cert;
content::CertStore::GetInstance()->RetrieveCert(cert_id_, &cert);
if (cert.get())
return new CefX509CertificateImpl(*cert);
}
return nullptr;
}

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.
#ifndef CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_
#define CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_
#pragma once
#include "include/cef_ssl_status.h"
#include "content/public/common/ssl_status.h"
// CefSSLStatus implementation
class CefSSLStatusImpl : public CefSSLStatus {
public:
explicit CefSSLStatusImpl(const content::SSLStatus& value);
// CefSSLStatus methods.
bool IsSecureConnection() override;
cef_cert_status_t GetCertStatus() override;
cef_ssl_version_t GetSSLVersion() override;
cef_ssl_content_status_t GetContentStatus() override;
CefRefPtr<CefX509Certificate> GetX509Certificate() override;
private:
cef_cert_status_t cert_status_;
cef_ssl_version_t ssl_version_;
cef_ssl_content_status_t content_status_;
int cert_id_;
IMPLEMENT_REFCOUNTING(CefSSLStatusImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLStatusImpl);
};
#endif // CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_

View File

@ -1,8 +1,8 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
#include "libcef/browser/ssl_cert_principal_impl.h" #include "libcef/browser/x509_cert_principal_impl.h"
namespace { namespace {
@ -20,47 +20,47 @@ void TransferVector(const std::vector<std::string>& source,
} // namespace } // namespace
CefSSLCertPrincipalImpl::CefSSLCertPrincipalImpl( CefX509CertPrincipalImpl::CefX509CertPrincipalImpl(
const net::CertPrincipal& value) const net::CertPrincipal& value)
: value_(value) { : value_(value) {
} }
CefString CefSSLCertPrincipalImpl::GetDisplayName() { CefString CefX509CertPrincipalImpl::GetDisplayName() {
return value_.GetDisplayName(); return value_.GetDisplayName();
} }
CefString CefSSLCertPrincipalImpl::GetCommonName() { CefString CefX509CertPrincipalImpl::GetCommonName() {
return value_.common_name; return value_.common_name;
} }
CefString CefSSLCertPrincipalImpl::GetLocalityName() { CefString CefX509CertPrincipalImpl::GetLocalityName() {
return value_.locality_name; return value_.locality_name;
} }
CefString CefSSLCertPrincipalImpl::GetStateOrProvinceName() { CefString CefX509CertPrincipalImpl::GetStateOrProvinceName() {
return value_.state_or_province_name; return value_.state_or_province_name;
} }
CefString CefSSLCertPrincipalImpl::GetCountryName() { CefString CefX509CertPrincipalImpl::GetCountryName() {
return value_.country_name; return value_.country_name;
} }
void CefSSLCertPrincipalImpl::GetStreetAddresses( void CefX509CertPrincipalImpl::GetStreetAddresses(
std::vector<CefString>& addresses) { std::vector<CefString>& addresses) {
TransferVector(value_.street_addresses, addresses); TransferVector(value_.street_addresses, addresses);
} }
void CefSSLCertPrincipalImpl::GetOrganizationNames( void CefX509CertPrincipalImpl::GetOrganizationNames(
std::vector<CefString>& names) { std::vector<CefString>& names) {
TransferVector(value_.organization_names, names); TransferVector(value_.organization_names, names);
} }
void CefSSLCertPrincipalImpl::GetOrganizationUnitNames( void CefX509CertPrincipalImpl::GetOrganizationUnitNames(
std::vector<CefString>& names) { std::vector<CefString>& names) {
TransferVector(value_.organization_unit_names, names); TransferVector(value_.organization_unit_names, names);
} }
void CefSSLCertPrincipalImpl::GetDomainComponents( void CefX509CertPrincipalImpl::GetDomainComponents(
std::vector<CefString>& components) { std::vector<CefString>& components) {
TransferVector(value_.domain_components, components); TransferVector(value_.domain_components, components);
} }

View File

@ -1,21 +1,21 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_ #ifndef CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_
#define CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_ #define CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_
#pragma once #pragma once
#include "include/cef_ssl_info.h" #include "include/cef_x509_certificate.h"
#include "net/cert/x509_cert_types.h" #include "net/cert/x509_cert_types.h"
// CefSSLCertPrincipal implementation // CefX509CertPrincipal implementation
class CefSSLCertPrincipalImpl : public CefSSLCertPrincipal { class CefX509CertPrincipalImpl : public CefX509CertPrincipal {
public: public:
explicit CefSSLCertPrincipalImpl(const net::CertPrincipal& value); explicit CefX509CertPrincipalImpl(const net::CertPrincipal& value);
// CefSSLCertPrincipal methods. // CefX509CertPrincipal methods.
CefString GetDisplayName() override; CefString GetDisplayName() override;
CefString GetCommonName() override; CefString GetCommonName() override;
CefString GetLocalityName() override; CefString GetLocalityName() override;
@ -29,8 +29,8 @@ class CefSSLCertPrincipalImpl : public CefSSLCertPrincipal {
private: private:
net::CertPrincipal value_; net::CertPrincipal value_;
IMPLEMENT_REFCOUNTING(CefSSLCertPrincipalImpl); IMPLEMENT_REFCOUNTING(CefX509CertPrincipalImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLCertPrincipalImpl); DISALLOW_COPY_AND_ASSIGN(CefX509CertPrincipalImpl);
}; };
#endif // CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_

View File

@ -0,0 +1,104 @@
// 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.
#include "libcef/browser/x509_certificate_impl.h"
#include "libcef/browser/x509_cert_principal_impl.h"
#include "libcef/common/time_util.h"
namespace {
void EncodeCertificate(
const net::X509Certificate::OSCertHandle& os_handle,
CefRefPtr<CefBinaryValue>& der_encoded,
CefRefPtr<CefBinaryValue>& pem_encoded) {
std::string encoded;
if (net::X509Certificate::GetDEREncoded(os_handle, &encoded)) {
der_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
encoded.clear();
if (net::X509Certificate::GetPEMEncoded(os_handle, &encoded)) {
pem_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
}
} // namespace
CefX509CertificateImpl::CefX509CertificateImpl(
const net::X509Certificate& value) {
subject_ = new CefX509CertPrincipalImpl(value.subject());
issuer_ = new CefX509CertPrincipalImpl(value.issuer());
const std::string& serial_number = value.serial_number();
serial_number_ = CefBinaryValue::Create(serial_number.c_str(),
serial_number.size());
const base::Time& valid_start = value.valid_start();
if (!valid_start.is_null())
cef_time_from_basetime(valid_start, valid_start_);
const base::Time& valid_expiry = value.valid_expiry();
if (!valid_expiry.is_null())
cef_time_from_basetime(valid_expiry, valid_expiry_);
net::X509Certificate::OSCertHandle os_handle = value.os_cert_handle();
if (os_handle)
EncodeCertificate(os_handle, der_encoded_, pem_encoded_);
const net::X509Certificate::OSCertHandles& issuer_chain =
value.GetIntermediateCertificates();
for (net::X509Certificate::OSCertHandles::const_iterator it =
issuer_chain.begin(); it != issuer_chain.end(); it++) {
CefRefPtr<CefBinaryValue> der_encoded, pem_encoded;
EncodeCertificate(*it, der_encoded, pem_encoded);
// Add each to the chain, even if one conversion unexpectedly failed.
// GetIssuerChainSize depends on these being the same length.
der_encoded_issuer_chain_.push_back(der_encoded);
pem_encoded_issuer_chain_.push_back(pem_encoded);
}
}
CefRefPtr<CefX509CertPrincipal> CefX509CertificateImpl::GetSubject() {
return subject_;
}
CefRefPtr<CefX509CertPrincipal> CefX509CertificateImpl::GetIssuer() {
return issuer_;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetSerialNumber() {
return serial_number_;
}
CefTime CefX509CertificateImpl::GetValidStart() {
return valid_start_;
}
CefTime CefX509CertificateImpl::GetValidExpiry() {
return valid_expiry_;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetDEREncoded() {
return der_encoded_;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetPEMEncoded() {
return pem_encoded_;
}
size_t CefX509CertificateImpl::GetIssuerChainSize() {
return der_encoded_issuer_chain_.size();
}
void CefX509CertificateImpl::GetDEREncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain) {
chain = der_encoded_issuer_chain_;
}
void CefX509CertificateImpl::GetPEMEncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain) {
chain = pem_encoded_issuer_chain_;
}

View File

@ -0,0 +1,45 @@
// 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.
#ifndef CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
#define CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
#pragma once
#include "include/cef_x509_certificate.h"
#include "net/cert/x509_certificate.h"
// CefX509Certificate implementation
class CefX509CertificateImpl : public CefX509Certificate {
public:
explicit CefX509CertificateImpl(const net::X509Certificate& value);
// CefX509Certificate methods.
CefRefPtr<CefX509CertPrincipal> GetSubject() override;
CefRefPtr<CefX509CertPrincipal> GetIssuer() override;
CefRefPtr<CefBinaryValue> GetSerialNumber() override;
CefTime GetValidStart() override;
CefTime GetValidExpiry() override;
CefRefPtr<CefBinaryValue> GetDEREncoded() override;
CefRefPtr<CefBinaryValue> GetPEMEncoded() override;
size_t GetIssuerChainSize() override;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) override;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
private:
CefRefPtr<CefX509CertPrincipal> subject_;
CefRefPtr<CefX509CertPrincipal> issuer_;
CefRefPtr<CefBinaryValue> serial_number_;
CefTime valid_start_;
CefTime valid_expiry_;
CefRefPtr<CefBinaryValue> der_encoded_;
CefRefPtr<CefBinaryValue> pem_encoded_;
IssuerChainBinaryList der_encoded_issuer_chain_;
IssuerChainBinaryList pem_encoded_issuer_chain_;
IMPLEMENT_REFCOUNTING(CefX509CertificateImpl);
DISALLOW_COPY_AND_ASSIGN(CefX509CertificateImpl);
};
#endif // CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_

View File

@ -13,6 +13,7 @@
#include "libcef_dll/cpptoc/browser_cpptoc.h" #include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/browser_host_cpptoc.h" #include "libcef_dll/cpptoc/browser_host_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_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/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h" #include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/download_image_callback_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(); 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 } // namespace
@ -1003,6 +1020,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->drag_source_ended_at = browser_host_drag_source_ended_at; GetStruct()->drag_source_ended_at = browser_host_drag_source_ended_at;
GetStruct()->drag_source_system_drag_ended = GetStruct()->drag_source_system_drag_ended =
browser_host_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, template<> CefRefPtr<CefBrowserHost> CefCppToC<CefBrowserHostCppToC,

View File

@ -11,6 +11,7 @@
// //
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h" #include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/sslstatus_cpptoc.h"
namespace { namespace {
@ -153,6 +154,22 @@ int CEF_CALLBACK navigation_entry_get_http_status_code(
return _retval; 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 } // namespace
@ -168,6 +185,7 @@ CefNavigationEntryCppToC::CefNavigationEntryCppToC() {
GetStruct()->has_post_data = navigation_entry_has_post_data; GetStruct()->has_post_data = navigation_entry_has_post_data;
GetStruct()->get_completion_time = navigation_entry_get_completion_time; GetStruct()->get_completion_time = navigation_entry_get_completion_time;
GetStruct()->get_http_status_code = navigation_entry_get_http_status_code; GetStruct()->get_http_status_code = navigation_entry_get_http_status_code;
GetStruct()->get_sslstatus = navigation_entry_get_sslstatus;
} }
template<> CefRefPtr<CefNavigationEntry> CefCppToC<CefNavigationEntryCppToC, template<> CefRefPtr<CefNavigationEntry> CefCppToC<CefNavigationEntryCppToC,

View File

@ -20,6 +20,8 @@
#include "include/cef_navigation_entry.h" #include "include/cef_navigation_entry.h"
#include "include/capi/cef_navigation_entry_capi.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" #include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure. // Wrap a C++ class with a C structure.

View File

@ -10,10 +10,8 @@
// for more information. // 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/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace { namespace {
@ -35,36 +33,7 @@ cef_cert_status_t CEF_CALLBACK sslinfo_get_cert_status(
return _retval; return _retval;
} }
int CEF_CALLBACK sslinfo_is_cert_status_error(struct _cef_sslinfo_t* self) { struct _cef_x509certificate_t* CEF_CALLBACK sslinfo_get_x509certificate(
// 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_sslinfo_t* self) { struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -73,189 +42,11 @@ cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
return NULL; return NULL;
// Execute // Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get( CefRefPtr<CefX509Certificate> _retval = CefSSLInfoCppToC::Get(
self)->GetSubject(); self)->GetX509Certificate();
// Return type: refptr_same // Return type: refptr_same
return CefSSLCertPrincipalCppToC::Wrap(_retval); return CefX509CertificateCppToC::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]);
}
}
}
} }
} // namespace } // namespace
@ -265,20 +56,7 @@ void CEF_CALLBACK sslinfo_get_pemencoded_issuer_chain(
CefSSLInfoCppToC::CefSSLInfoCppToC() { CefSSLInfoCppToC::CefSSLInfoCppToC() {
GetStruct()->get_cert_status = sslinfo_get_cert_status; GetStruct()->get_cert_status = sslinfo_get_cert_status;
GetStruct()->is_cert_status_error = sslinfo_is_cert_status_error; GetStruct()->get_x509certificate = sslinfo_get_x509certificate;
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;
} }
template<> CefRefPtr<CefSSLInfo> CefCppToC<CefSSLInfoCppToC, CefSSLInfo, 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. // 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" #include "libcef_dll/transfer_util.h"
@ -18,8 +18,8 @@ namespace {
// MEMBER FUNCTIONS - Body may be edited by hand. // MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name( cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_display_name(
struct _cef_sslcert_principal_t* self) { struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -27,14 +27,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
return NULL; return NULL;
// Execute // Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetDisplayName(); CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetDisplayName();
// Return type: string // Return type: string
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name( cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_common_name(
struct _cef_sslcert_principal_t* self) { struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -42,14 +42,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
return NULL; return NULL;
// Execute // Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCommonName(); CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetCommonName();
// Return type: string // Return type: string
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name( cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_locality_name(
struct _cef_sslcert_principal_t* self) { struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -57,14 +57,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
return NULL; return NULL;
// Execute // Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetLocalityName(); CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetLocalityName();
// Return type: string // Return type: string
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name( cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_state_or_province_name(
struct _cef_sslcert_principal_t* self) { struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -72,15 +72,15 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
return NULL; return NULL;
// Execute // Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get( CefString _retval = CefX509CertPrincipalCppToC::Get(
self)->GetStateOrProvinceName(); self)->GetStateOrProvinceName();
// Return type: string // Return type: string
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name( cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_country_name(
struct _cef_sslcert_principal_t* self) { struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -88,14 +88,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
return NULL; return NULL;
// Execute // Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCountryName(); CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetCountryName();
// Return type: string // Return type: string
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
void CEF_CALLBACK sslcert_principal_get_street_addresses( void CEF_CALLBACK x509cert_principal_get_street_addresses(
struct _cef_sslcert_principal_t* self, cef_string_list_t addresses) { struct _cef_x509cert_principal_t* self, cef_string_list_t addresses) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -111,7 +111,7 @@ void CEF_CALLBACK sslcert_principal_get_street_addresses(
transfer_string_list_contents(addresses, addressesList); transfer_string_list_contents(addresses, addressesList);
// Execute // Execute
CefSSLCertPrincipalCppToC::Get(self)->GetStreetAddresses( CefX509CertPrincipalCppToC::Get(self)->GetStreetAddresses(
addressesList); addressesList);
// Restore param: addresses; type: string_vec_byref // 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); transfer_string_list_contents(addressesList, addresses);
} }
void CEF_CALLBACK sslcert_principal_get_organization_names( void CEF_CALLBACK x509cert_principal_get_organization_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) { struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -136,7 +136,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_names(
transfer_string_list_contents(names, namesList); transfer_string_list_contents(names, namesList);
// Execute // Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationNames( CefX509CertPrincipalCppToC::Get(self)->GetOrganizationNames(
namesList); namesList);
// Restore param: names; type: string_vec_byref // 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); transfer_string_list_contents(namesList, names);
} }
void CEF_CALLBACK sslcert_principal_get_organization_unit_names( void CEF_CALLBACK x509cert_principal_get_organization_unit_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) { struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -161,7 +161,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
transfer_string_list_contents(names, namesList); transfer_string_list_contents(names, namesList);
// Execute // Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationUnitNames( CefX509CertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
namesList); namesList);
// Restore param: names; type: string_vec_byref // 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); transfer_string_list_contents(namesList, names);
} }
void CEF_CALLBACK sslcert_principal_get_domain_components( void CEF_CALLBACK x509cert_principal_get_domain_components(
struct _cef_sslcert_principal_t* self, cef_string_list_t components) { struct _cef_x509cert_principal_t* self, cef_string_list_t components) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -186,7 +186,7 @@ void CEF_CALLBACK sslcert_principal_get_domain_components(
transfer_string_list_contents(components, componentsList); transfer_string_list_contents(components, componentsList);
// Execute // Execute
CefSSLCertPrincipalCppToC::Get(self)->GetDomainComponents( CefX509CertPrincipalCppToC::Get(self)->GetDomainComponents(
componentsList); componentsList);
// Restore param: components; type: string_vec_byref // 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. // CONSTRUCTOR - Do not edit by hand.
CefSSLCertPrincipalCppToC::CefSSLCertPrincipalCppToC() { CefX509CertPrincipalCppToC::CefX509CertPrincipalCppToC() {
GetStruct()->get_display_name = sslcert_principal_get_display_name; GetStruct()->get_display_name = x509cert_principal_get_display_name;
GetStruct()->get_common_name = sslcert_principal_get_common_name; GetStruct()->get_common_name = x509cert_principal_get_common_name;
GetStruct()->get_locality_name = sslcert_principal_get_locality_name; GetStruct()->get_locality_name = x509cert_principal_get_locality_name;
GetStruct()->get_state_or_province_name = GetStruct()->get_state_or_province_name =
sslcert_principal_get_state_or_province_name; x509cert_principal_get_state_or_province_name;
GetStruct()->get_country_name = sslcert_principal_get_country_name; GetStruct()->get_country_name = x509cert_principal_get_country_name;
GetStruct()->get_street_addresses = sslcert_principal_get_street_addresses; GetStruct()->get_street_addresses = x509cert_principal_get_street_addresses;
GetStruct()->get_organization_names = GetStruct()->get_organization_names =
sslcert_principal_get_organization_names; x509cert_principal_get_organization_names;
GetStruct()->get_organization_unit_names = GetStruct()->get_organization_unit_names =
sslcert_principal_get_organization_unit_names; x509cert_principal_get_organization_unit_names;
GetStruct()->get_domain_components = sslcert_principal_get_domain_components; GetStruct()->get_domain_components = x509cert_principal_get_domain_components;
} }
template<> CefRefPtr<CefSSLCertPrincipal> CefCppToC<CefSSLCertPrincipalCppToC, template<> CefRefPtr<CefX509CertPrincipal> CefCppToC<CefX509CertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::UnwrapDerived( CefX509CertPrincipal, cef_x509cert_principal_t>::UnwrapDerived(
CefWrapperType type, cef_sslcert_principal_t* s) { CefWrapperType type, cef_x509cert_principal_t* s) {
NOTREACHED() << "Unexpected class type: " << type; NOTREACHED() << "Unexpected class type: " << type;
return NULL; return NULL;
} }
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSSLCertPrincipalCppToC, template<> base::AtomicRefCount CefCppToC<CefX509CertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0; CefX509CertPrincipal, cef_x509cert_principal_t>::DebugObjCt = 0;
#endif #endif
template<> CefWrapperType CefCppToC<CefSSLCertPrincipalCppToC, template<> CefWrapperType CefCppToC<CefX509CertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::kWrapperType = CefX509CertPrincipal, cef_x509cert_principal_t>::kWrapperType =
WT_SSLCERT_PRINCIPAL; 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. // for more information.
// //
#ifndef CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_ #ifndef CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_ #define CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_CPPTOC_H_
#pragma once #pragma once
#ifndef BUILDING_CEF_SHARED #ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only") #pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED #else // BUILDING_CEF_SHARED
#include "include/cef_ssl_info.h" #include "include/cef_x509_certificate.h"
#include "include/capi/cef_ssl_info_capi.h" #include "include/capi/cef_x509_certificate_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h" #include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure. // Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only. // This class may be instantiated and accessed DLL-side only.
class CefSSLCertPrincipalCppToC class CefX509CertificateCppToC
: public CefCppToC<CefSSLCertPrincipalCppToC, CefSSLCertPrincipal, : public CefCppToC<CefX509CertificateCppToC, CefX509Certificate,
cef_sslcert_principal_t> { cef_x509certificate_t> {
public: public:
CefSSLCertPrincipalCppToC(); CefX509CertificateCppToC();
}; };
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLCERT_PRINCIPAL_CPPTOC_H_ #endif // CEF_LIBCEF_DLL_CPPTOC_X509CERTIFICATE_CPPTOC_H_

View File

@ -18,6 +18,7 @@
#include "libcef_dll/ctocpp/browser_ctocpp.h" #include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/browser_host_ctocpp.h" #include "libcef_dll/ctocpp/browser_host_ctocpp.h"
#include "libcef_dll/ctocpp/drag_data_ctocpp.h" #include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h" #include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/transfer_util.h" #include "libcef_dll/transfer_util.h"
@ -789,6 +790,22 @@ void CefBrowserHostCToCpp::DragSourceSystemDragEnded() {
_struct->drag_source_system_drag_ended(_struct); _struct->drag_source_system_drag_ended(_struct);
} }
CefRefPtr<CefNavigationEntry> CefBrowserHostCToCpp::GetVisibleNavigationEntry(
) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_visible_navigation_entry))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_navigation_entry_t* _retval = _struct->get_visible_navigation_entry(
_struct);
// Return type: refptr_same
return CefNavigationEntryCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.

View File

@ -97,6 +97,7 @@ class CefBrowserHostCToCpp
void DragTargetDrop(const CefMouseEvent& event) OVERRIDE; void DragTargetDrop(const CefMouseEvent& event) OVERRIDE;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) OVERRIDE; void DragSourceEndedAt(int x, int y, DragOperationsMask op) OVERRIDE;
void DragSourceSystemDragEnded() OVERRIDE; void DragSourceSystemDragEnded() OVERRIDE;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() OVERRIDE;
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED

View File

@ -11,6 +11,7 @@
// //
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h" #include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
#include "libcef_dll/ctocpp/sslstatus_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand. // VIRTUAL METHODS - Body may be edited by hand.
@ -150,6 +151,20 @@ int CefNavigationEntryCToCpp::GetHttpStatusCode() {
return _retval; return _retval;
} }
CefRefPtr<CefSSLStatus> CefNavigationEntryCToCpp::GetSSLStatus() {
cef_navigation_entry_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_sslstatus))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_sslstatus_t* _retval = _struct->get_sslstatus(_struct);
// Return type: refptr_same
return CefSSLStatusCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.

View File

@ -20,6 +20,8 @@
#include "include/cef_navigation_entry.h" #include "include/cef_navigation_entry.h"
#include "include/capi/cef_navigation_entry_capi.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/ctocpp/ctocpp.h" #include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class. // Wrap a C structure with a C++ class.
@ -40,6 +42,7 @@ class CefNavigationEntryCToCpp
bool HasPostData() OVERRIDE; bool HasPostData() OVERRIDE;
CefTime GetCompletionTime() OVERRIDE; CefTime GetCompletionTime() OVERRIDE;
int GetHttpStatusCode() OVERRIDE; int GetHttpStatusCode() OVERRIDE;
CefRefPtr<CefSSLStatus> GetSSLStatus() OVERRIDE;
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED

View File

@ -10,10 +10,8 @@
// for more information. // for more information.
// //
#include <algorithm>
#include "libcef_dll/ctocpp/binary_value_ctocpp.h"
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h" #include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand. // VIRTUAL METHODS - Body may be edited by hand.
@ -32,222 +30,18 @@ cef_cert_status_t CefSSLInfoCToCpp::GetCertStatus() {
return _retval; return _retval;
} }
bool CefSSLInfoCToCpp::IsCertStatusError() { CefRefPtr<CefX509Certificate> CefSSLInfoCToCpp::GetX509Certificate() {
cef_sslinfo_t* _struct = GetStruct(); cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_cert_status_error)) if (CEF_MEMBER_MISSING(_struct, get_x509certificate))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_cert_status_error(_struct);
// Return type: bool
return _retval?true:false;
}
bool CefSSLInfoCToCpp::IsCertStatusMinorError() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_cert_status_minor_error))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_cert_status_minor_error(_struct);
// Return type: bool
return _retval?true:false;
}
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoCToCpp::GetSubject() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_subject))
return NULL; return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute // Execute
cef_sslcert_principal_t* _retval = _struct->get_subject(_struct); cef_x509certificate_t* _retval = _struct->get_x509certificate(_struct);
// Return type: refptr_same // Return type: refptr_same
return CefSSLCertPrincipalCToCpp::Wrap(_retval); return CefX509CertificateCToCpp::Wrap(_retval);
}
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoCToCpp::GetIssuer() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_issuer))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_sslcert_principal_t* _retval = _struct->get_issuer(_struct);
// Return type: refptr_same
return CefSSLCertPrincipalCToCpp::Wrap(_retval);
}
CefRefPtr<CefBinaryValue> CefSSLInfoCToCpp::GetSerialNumber() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_serial_number))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_serial_number(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
CefTime CefSSLInfoCToCpp::GetValidStart() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_valid_start))
return CefTime();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_time_t _retval = _struct->get_valid_start(_struct);
// Return type: simple
return _retval;
}
CefTime CefSSLInfoCToCpp::GetValidExpiry() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_valid_expiry))
return CefTime();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_time_t _retval = _struct->get_valid_expiry(_struct);
// Return type: simple
return _retval;
}
CefRefPtr<CefBinaryValue> CefSSLInfoCToCpp::GetDEREncoded() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_derencoded))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_derencoded(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
CefRefPtr<CefBinaryValue> CefSSLInfoCToCpp::GetPEMEncoded() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_pemencoded))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_pemencoded(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
size_t CefSSLInfoCToCpp::GetIssuerChainSize() {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_issuer_chain_size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->get_issuer_chain_size(_struct);
// Return type: simple
return _retval;
}
void CefSSLInfoCToCpp::GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_derencoded_issuer_chain))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: chain; type: refptr_vec_same_byref
size_t chainSize = chain.size();
size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
cef_binary_value_t** chainList = NULL;
if (chainCount > 0) {
chainList = new cef_binary_value_t*[chainCount];
DCHECK(chainList);
if (chainList) {
memset(chainList, 0, sizeof(cef_binary_value_t*)*chainCount);
}
if (chainList && chainSize > 0) {
for (size_t i = 0; i < chainSize; ++i) {
chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
}
}
}
// Execute
_struct->get_derencoded_issuer_chain(_struct,
&chainCount,
chainList);
// Restore param:chain; type: refptr_vec_same_byref
chain.clear();
if (chainCount > 0 && chainList) {
for (size_t i = 0; i < chainCount; ++i) {
chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
}
delete [] chainList;
}
}
void CefSSLInfoCToCpp::GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) {
cef_sslinfo_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_pemencoded_issuer_chain))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: chain; type: refptr_vec_same_byref
size_t chainSize = chain.size();
size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
cef_binary_value_t** chainList = NULL;
if (chainCount > 0) {
chainList = new cef_binary_value_t*[chainCount];
DCHECK(chainList);
if (chainList) {
memset(chainList, 0, sizeof(cef_binary_value_t*)*chainCount);
}
if (chainList && chainSize > 0) {
for (size_t i = 0; i < chainSize; ++i) {
chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
}
}
}
// Execute
_struct->get_pemencoded_issuer_chain(_struct,
&chainCount,
chainList);
// Restore param:chain; type: refptr_vec_same_byref
chain.clear();
if (chainCount > 0 && chainList) {
for (size_t i = 0; i < chainCount; ++i) {
chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
}
delete [] chainList;
}
} }

View File

@ -31,18 +31,7 @@ class CefSSLInfoCToCpp
// CefSSLInfo methods. // CefSSLInfo methods.
cef_cert_status_t GetCertStatus() OVERRIDE; cef_cert_status_t GetCertStatus() OVERRIDE;
bool IsCertStatusError() OVERRIDE; CefRefPtr<CefX509Certificate> GetX509Certificate() OVERRIDE;
bool IsCertStatusMinorError() OVERRIDE;
CefRefPtr<CefSSLCertPrincipal> GetSubject() OVERRIDE;
CefRefPtr<CefSSLCertPrincipal> GetIssuer() OVERRIDE;
CefRefPtr<CefBinaryValue> GetSerialNumber() OVERRIDE;
CefTime GetValidStart() OVERRIDE;
CefTime GetValidExpiry() OVERRIDE;
CefRefPtr<CefBinaryValue> GetDEREncoded() OVERRIDE;
CefRefPtr<CefBinaryValue> GetPEMEncoded() OVERRIDE;
size_t GetIssuerChainSize() OVERRIDE;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) OVERRIDE;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) OVERRIDE;
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED

View File

@ -0,0 +1,107 @@
// 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/ctocpp/sslstatus_ctocpp.h"
#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefSSLStatusCToCpp::IsSecureConnection() {
cef_sslstatus_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_secure_connection))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_secure_connection(_struct);
// Return type: bool
return _retval?true:false;
}
cef_cert_status_t CefSSLStatusCToCpp::GetCertStatus() {
cef_sslstatus_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_cert_status))
return CERT_STATUS_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_cert_status_t _retval = _struct->get_cert_status(_struct);
// Return type: simple
return _retval;
}
cef_ssl_version_t CefSSLStatusCToCpp::GetSSLVersion() {
cef_sslstatus_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_sslversion))
return SSL_CONNECTION_VERSION_UNKNOWN;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_ssl_version_t _retval = _struct->get_sslversion(_struct);
// Return type: simple
return _retval;
}
cef_ssl_content_status_t CefSSLStatusCToCpp::GetContentStatus() {
cef_sslstatus_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_content_status))
return SSL_CONTENT_NORMAL_CONTENT;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_ssl_content_status_t _retval = _struct->get_content_status(_struct);
// Return type: simple
return _retval;
}
CefRefPtr<CefX509Certificate> CefSSLStatusCToCpp::GetX509Certificate() {
cef_sslstatus_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_x509certificate))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_x509certificate_t* _retval = _struct->get_x509certificate(_struct);
// Return type: refptr_same
return CefX509CertificateCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefSSLStatusCToCpp::CefSSLStatusCToCpp() {
}
template<> cef_sslstatus_t* CefCToCpp<CefSSLStatusCToCpp, CefSSLStatus,
cef_sslstatus_t>::UnwrapDerived(CefWrapperType type, CefSSLStatus* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefSSLStatusCToCpp, CefSSLStatus,
cef_sslstatus_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefSSLStatusCToCpp, CefSSLStatus,
cef_sslstatus_t>::kWrapperType = WT_SSLSTATUS;

View File

@ -0,0 +1,43 @@
// 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_CTOCPP_SSLSTATUS_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_SSLSTATUS_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_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/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefSSLStatusCToCpp
: public CefCToCpp<CefSSLStatusCToCpp, CefSSLStatus, cef_sslstatus_t> {
public:
CefSSLStatusCToCpp();
// CefSSLStatus methods.
bool IsSecureConnection() OVERRIDE;
cef_cert_status_t GetCertStatus() OVERRIDE;
cef_ssl_version_t GetSSLVersion() OVERRIDE;
cef_ssl_content_status_t GetContentStatus() OVERRIDE;
CefRefPtr<CefX509Certificate> GetX509Certificate() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_SSLSTATUS_CTOCPP_H_

View File

@ -10,14 +10,14 @@
// for more information. // for more information.
// //
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h" #include "libcef_dll/ctocpp/x509cert_principal_ctocpp.h"
#include "libcef_dll/transfer_util.h" #include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand. // VIRTUAL METHODS - Body may be edited by hand.
CefString CefSSLCertPrincipalCToCpp::GetDisplayName() { CefString CefX509CertPrincipalCToCpp::GetDisplayName() {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_display_name)) if (CEF_MEMBER_MISSING(_struct, get_display_name))
return CefString(); return CefString();
@ -32,8 +32,8 @@ CefString CefSSLCertPrincipalCToCpp::GetDisplayName() {
return _retvalStr; return _retvalStr;
} }
CefString CefSSLCertPrincipalCToCpp::GetCommonName() { CefString CefX509CertPrincipalCToCpp::GetCommonName() {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_common_name)) if (CEF_MEMBER_MISSING(_struct, get_common_name))
return CefString(); return CefString();
@ -48,8 +48,8 @@ CefString CefSSLCertPrincipalCToCpp::GetCommonName() {
return _retvalStr; return _retvalStr;
} }
CefString CefSSLCertPrincipalCToCpp::GetLocalityName() { CefString CefX509CertPrincipalCToCpp::GetLocalityName() {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_locality_name)) if (CEF_MEMBER_MISSING(_struct, get_locality_name))
return CefString(); return CefString();
@ -64,8 +64,8 @@ CefString CefSSLCertPrincipalCToCpp::GetLocalityName() {
return _retvalStr; return _retvalStr;
} }
CefString CefSSLCertPrincipalCToCpp::GetStateOrProvinceName() { CefString CefX509CertPrincipalCToCpp::GetStateOrProvinceName() {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_state_or_province_name)) if (CEF_MEMBER_MISSING(_struct, get_state_or_province_name))
return CefString(); return CefString();
@ -80,8 +80,8 @@ CefString CefSSLCertPrincipalCToCpp::GetStateOrProvinceName() {
return _retvalStr; return _retvalStr;
} }
CefString CefSSLCertPrincipalCToCpp::GetCountryName() { CefString CefX509CertPrincipalCToCpp::GetCountryName() {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_country_name)) if (CEF_MEMBER_MISSING(_struct, get_country_name))
return CefString(); return CefString();
@ -96,9 +96,9 @@ CefString CefSSLCertPrincipalCToCpp::GetCountryName() {
return _retvalStr; return _retvalStr;
} }
void CefSSLCertPrincipalCToCpp::GetStreetAddresses( void CefX509CertPrincipalCToCpp::GetStreetAddresses(
std::vector<CefString>& addresses) { std::vector<CefString>& addresses) {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_street_addresses)) if (CEF_MEMBER_MISSING(_struct, get_street_addresses))
return; return;
@ -122,9 +122,9 @@ void CefSSLCertPrincipalCToCpp::GetStreetAddresses(
} }
} }
void CefSSLCertPrincipalCToCpp::GetOrganizationNames( void CefX509CertPrincipalCToCpp::GetOrganizationNames(
std::vector<CefString>& names) { std::vector<CefString>& names) {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_organization_names)) if (CEF_MEMBER_MISSING(_struct, get_organization_names))
return; return;
@ -148,9 +148,9 @@ void CefSSLCertPrincipalCToCpp::GetOrganizationNames(
} }
} }
void CefSSLCertPrincipalCToCpp::GetOrganizationUnitNames( void CefX509CertPrincipalCToCpp::GetOrganizationUnitNames(
std::vector<CefString>& names) { std::vector<CefString>& names) {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_organization_unit_names)) if (CEF_MEMBER_MISSING(_struct, get_organization_unit_names))
return; return;
@ -174,9 +174,9 @@ void CefSSLCertPrincipalCToCpp::GetOrganizationUnitNames(
} }
} }
void CefSSLCertPrincipalCToCpp::GetDomainComponents( void CefX509CertPrincipalCToCpp::GetDomainComponents(
std::vector<CefString>& components) { std::vector<CefString>& components) {
cef_sslcert_principal_t* _struct = GetStruct(); cef_x509cert_principal_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_domain_components)) if (CEF_MEMBER_MISSING(_struct, get_domain_components))
return; return;
@ -203,21 +203,21 @@ void CefSSLCertPrincipalCToCpp::GetDomainComponents(
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.
CefSSLCertPrincipalCToCpp::CefSSLCertPrincipalCToCpp() { CefX509CertPrincipalCToCpp::CefX509CertPrincipalCToCpp() {
} }
template<> cef_sslcert_principal_t* CefCToCpp<CefSSLCertPrincipalCToCpp, template<> cef_x509cert_principal_t* CefCToCpp<CefX509CertPrincipalCToCpp,
CefSSLCertPrincipal, cef_sslcert_principal_t>::UnwrapDerived( CefX509CertPrincipal, cef_x509cert_principal_t>::UnwrapDerived(
CefWrapperType type, CefSSLCertPrincipal* c) { CefWrapperType type, CefX509CertPrincipal* c) {
NOTREACHED() << "Unexpected class type: " << type; NOTREACHED() << "Unexpected class type: " << type;
return NULL; return NULL;
} }
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefSSLCertPrincipalCToCpp, template<> base::AtomicRefCount CefCToCpp<CefX509CertPrincipalCToCpp,
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0; CefX509CertPrincipal, cef_x509cert_principal_t>::DebugObjCt = 0;
#endif #endif
template<> CefWrapperType CefCToCpp<CefSSLCertPrincipalCToCpp, template<> CefWrapperType CefCToCpp<CefX509CertPrincipalCToCpp,
CefSSLCertPrincipal, cef_sslcert_principal_t>::kWrapperType = CefX509CertPrincipal, cef_x509cert_principal_t>::kWrapperType =
WT_SSLCERT_PRINCIPAL; WT_X509CERT_PRINCIPAL;

View File

@ -10,8 +10,8 @@
// for more information. // for more information.
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_X509CERT_PRINCIPAL_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_ #define CEF_LIBCEF_DLL_CTOCPP_X509CERT_PRINCIPAL_CTOCPP_H_
#pragma once #pragma once
#ifndef USING_CEF_SHARED #ifndef USING_CEF_SHARED
@ -19,19 +19,19 @@
#else // USING_CEF_SHARED #else // USING_CEF_SHARED
#include <vector> #include <vector>
#include "include/cef_ssl_info.h" #include "include/cef_x509_certificate.h"
#include "include/capi/cef_ssl_info_capi.h" #include "include/capi/cef_x509_certificate_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h" #include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class. // Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only. // This class may be instantiated and accessed wrapper-side only.
class CefSSLCertPrincipalCToCpp class CefX509CertPrincipalCToCpp
: public CefCToCpp<CefSSLCertPrincipalCToCpp, CefSSLCertPrincipal, : public CefCToCpp<CefX509CertPrincipalCToCpp, CefX509CertPrincipal,
cef_sslcert_principal_t> { cef_x509cert_principal_t> {
public: public:
CefSSLCertPrincipalCToCpp(); CefX509CertPrincipalCToCpp();
// CefSSLCertPrincipal methods. // CefX509CertPrincipal methods.
CefString GetDisplayName() OVERRIDE; CefString GetDisplayName() OVERRIDE;
CefString GetCommonName() OVERRIDE; CefString GetCommonName() OVERRIDE;
CefString GetLocalityName() OVERRIDE; CefString GetLocalityName() OVERRIDE;
@ -44,4 +44,4 @@ class CefSSLCertPrincipalCToCpp
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_ #endif // CEF_LIBCEF_DLL_CTOCPP_X509CERT_PRINCIPAL_CTOCPP_H_

View File

@ -0,0 +1,233 @@
// 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/ctocpp/binary_value_ctocpp.h"
#include "libcef_dll/ctocpp/x509cert_principal_ctocpp.h"
#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
CefRefPtr<CefX509CertPrincipal> CefX509CertificateCToCpp::GetSubject() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_subject))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_x509cert_principal_t* _retval = _struct->get_subject(_struct);
// Return type: refptr_same
return CefX509CertPrincipalCToCpp::Wrap(_retval);
}
CefRefPtr<CefX509CertPrincipal> CefX509CertificateCToCpp::GetIssuer() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_issuer))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_x509cert_principal_t* _retval = _struct->get_issuer(_struct);
// Return type: refptr_same
return CefX509CertPrincipalCToCpp::Wrap(_retval);
}
CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetSerialNumber() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_serial_number))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_serial_number(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
CefTime CefX509CertificateCToCpp::GetValidStart() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_valid_start))
return CefTime();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_time_t _retval = _struct->get_valid_start(_struct);
// Return type: simple
return _retval;
}
CefTime CefX509CertificateCToCpp::GetValidExpiry() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_valid_expiry))
return CefTime();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_time_t _retval = _struct->get_valid_expiry(_struct);
// Return type: simple
return _retval;
}
CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetDEREncoded() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_derencoded))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_derencoded(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetPEMEncoded() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_pemencoded))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_binary_value_t* _retval = _struct->get_pemencoded(_struct);
// Return type: refptr_same
return CefBinaryValueCToCpp::Wrap(_retval);
}
size_t CefX509CertificateCToCpp::GetIssuerChainSize() {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_issuer_chain_size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->get_issuer_chain_size(_struct);
// Return type: simple
return _retval;
}
void CefX509CertificateCToCpp::GetDEREncodedIssuerChain(
IssuerChainBinaryList& chain) {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_derencoded_issuer_chain))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: chain; type: refptr_vec_same_byref
size_t chainSize = chain.size();
size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
cef_binary_value_t** chainList = NULL;
if (chainCount > 0) {
chainList = new cef_binary_value_t*[chainCount];
DCHECK(chainList);
if (chainList) {
memset(chainList, 0, sizeof(cef_binary_value_t*)*chainCount);
}
if (chainList && chainSize > 0) {
for (size_t i = 0; i < chainSize; ++i) {
chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
}
}
}
// Execute
_struct->get_derencoded_issuer_chain(_struct,
&chainCount,
chainList);
// Restore param:chain; type: refptr_vec_same_byref
chain.clear();
if (chainCount > 0 && chainList) {
for (size_t i = 0; i < chainCount; ++i) {
chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
}
delete [] chainList;
}
}
void CefX509CertificateCToCpp::GetPEMEncodedIssuerChain(
IssuerChainBinaryList& chain) {
cef_x509certificate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_pemencoded_issuer_chain))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: chain; type: refptr_vec_same_byref
size_t chainSize = chain.size();
size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
cef_binary_value_t** chainList = NULL;
if (chainCount > 0) {
chainList = new cef_binary_value_t*[chainCount];
DCHECK(chainList);
if (chainList) {
memset(chainList, 0, sizeof(cef_binary_value_t*)*chainCount);
}
if (chainList && chainSize > 0) {
for (size_t i = 0; i < chainSize; ++i) {
chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
}
}
}
// Execute
_struct->get_pemencoded_issuer_chain(_struct,
&chainCount,
chainList);
// Restore param:chain; type: refptr_vec_same_byref
chain.clear();
if (chainCount > 0 && chainList) {
for (size_t i = 0; i < chainCount; ++i) {
chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
}
delete [] chainList;
}
}
// CONSTRUCTOR - Do not edit by hand.
CefX509CertificateCToCpp::CefX509CertificateCToCpp() {
}
template<> cef_x509certificate_t* CefCToCpp<CefX509CertificateCToCpp,
CefX509Certificate, cef_x509certificate_t>::UnwrapDerived(
CefWrapperType type, CefX509Certificate* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefX509CertificateCToCpp,
CefX509Certificate, cef_x509certificate_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefX509CertificateCToCpp,
CefX509Certificate, cef_x509certificate_t>::kWrapperType =
WT_X509CERTIFICATE;

View File

@ -0,0 +1,47 @@
// 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_CTOCPP_X509CERTIFICATE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_X509CERTIFICATE_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_x509_certificate.h"
#include "include/capi/cef_x509_certificate_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefX509CertificateCToCpp
: public CefCToCpp<CefX509CertificateCToCpp, CefX509Certificate,
cef_x509certificate_t> {
public:
CefX509CertificateCToCpp();
// CefX509Certificate methods.
CefRefPtr<CefX509CertPrincipal> GetSubject() OVERRIDE;
CefRefPtr<CefX509CertPrincipal> GetIssuer() OVERRIDE;
CefRefPtr<CefBinaryValue> GetSerialNumber() OVERRIDE;
CefTime GetValidStart() OVERRIDE;
CefTime GetValidExpiry() OVERRIDE;
CefRefPtr<CefBinaryValue> GetDEREncoded() OVERRIDE;
CefRefPtr<CefBinaryValue> GetPEMEncoded() OVERRIDE;
size_t GetIssuerChainSize() OVERRIDE;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) OVERRIDE;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_X509CERTIFICATE_CTOCPP_H_

View File

@ -24,6 +24,8 @@
#include "include/capi/cef_process_util_capi.h" #include "include/capi/cef_process_util_capi.h"
#include "include/cef_scheme.h" #include "include/cef_scheme.h"
#include "include/capi/cef_scheme_capi.h" #include "include/capi/cef_scheme_capi.h"
#include "include/cef_ssl_info.h"
#include "include/capi/cef_ssl_info_capi.h"
#include "include/cef_task.h" #include "include/cef_task.h"
#include "include/capi/cef_task_capi.h" #include "include/capi/cef_task_capi.h"
#include "include/cef_trace.h" #include "include/cef_trace.h"
@ -69,8 +71,8 @@
#include "libcef_dll/cpptoc/process_message_cpptoc.h" #include "libcef_dll/cpptoc/process_message_cpptoc.h"
#include "libcef_dll/cpptoc/request_callback_cpptoc.h" #include "libcef_dll/cpptoc/request_callback_cpptoc.h"
#include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h" #include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h"
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h" #include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/sslstatus_cpptoc.h"
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h" #include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
#include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h" #include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h"
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" #include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
@ -87,6 +89,8 @@
#include "libcef_dll/cpptoc/views/view_cpptoc.h" #include "libcef_dll/cpptoc/views/view_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h" #include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
#include "libcef_dll/cpptoc/views/window_cpptoc.h" #include "libcef_dll/cpptoc/views/window_cpptoc.h"
#include "libcef_dll/cpptoc/x509cert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
#include "libcef_dll/cpptoc/xml_reader_cpptoc.h" #include "libcef_dll/cpptoc/xml_reader_cpptoc.h"
#include "libcef_dll/cpptoc/zip_reader_cpptoc.h" #include "libcef_dll/cpptoc/zip_reader_cpptoc.h"
#include "libcef_dll/ctocpp/app_ctocpp.h" #include "libcef_dll/ctocpp/app_ctocpp.h"
@ -297,8 +301,8 @@ CEF_EXPORT void cef_shutdown() {
&CefRunContextMenuCallbackCppToC::DebugObjCt)); &CefRunContextMenuCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero( DCHECK(base::AtomicRefCountIsZero(
&CefRunFileDialogCallbackCToCpp::DebugObjCt)); &CefRunFileDialogCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLCertPrincipalCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLInfoCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefSSLInfoCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLStatusCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero( DCHECK(base::AtomicRefCountIsZero(
&CefSchemeHandlerFactoryCToCpp::DebugObjCt)); &CefSchemeHandlerFactoryCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSchemeRegistrarCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefSchemeRegistrarCppToC::DebugObjCt));
@ -331,6 +335,8 @@ CEF_EXPORT void cef_shutdown() {
DCHECK(base::AtomicRefCountIsZero(&CefWindowCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWindowCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefWindowDelegateCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWindowDelegateCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefWriteHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWriteHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefX509CertPrincipalCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefX509CertificateCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefXmlReaderCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefXmlReaderCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefZipReaderCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefZipReaderCppToC::DebugObjCt));
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
@ -786,6 +792,28 @@ CEF_EXPORT int cef_clear_scheme_handler_factories() {
return _retval; return _retval;
} }
CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
bool _retval = CefIsCertStatusError(
status);
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
bool _retval = CefIsCertStatusMinorError(
status);
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) { CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -24,6 +24,8 @@
#include "include/capi/cef_process_util_capi.h" #include "include/capi/cef_process_util_capi.h"
#include "include/cef_scheme.h" #include "include/cef_scheme.h"
#include "include/capi/cef_scheme_capi.h" #include "include/capi/cef_scheme_capi.h"
#include "include/cef_ssl_info.h"
#include "include/capi/cef_ssl_info_capi.h"
#include "include/cef_task.h" #include "include/cef_task.h"
#include "include/capi/cef_task_capi.h" #include "include/capi/cef_task_capi.h"
#include "include/cef_trace.h" #include "include/cef_trace.h"
@ -121,8 +123,8 @@
#include "libcef_dll/ctocpp/process_message_ctocpp.h" #include "libcef_dll/ctocpp/process_message_ctocpp.h"
#include "libcef_dll/ctocpp/request_callback_ctocpp.h" #include "libcef_dll/ctocpp/request_callback_ctocpp.h"
#include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h" #include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h"
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h" #include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/sslstatus_ctocpp.h"
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h" #include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
#include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h" #include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h"
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" #include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
@ -139,6 +141,8 @@
#include "libcef_dll/ctocpp/views/view_ctocpp.h" #include "libcef_dll/ctocpp/views/view_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h" #include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
#include "libcef_dll/ctocpp/views/window_ctocpp.h" #include "libcef_dll/ctocpp/views/window_ctocpp.h"
#include "libcef_dll/ctocpp/x509cert_principal_ctocpp.h"
#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
#include "libcef_dll/ctocpp/xml_reader_ctocpp.h" #include "libcef_dll/ctocpp/xml_reader_ctocpp.h"
#include "libcef_dll/ctocpp/zip_reader_ctocpp.h" #include "libcef_dll/ctocpp/zip_reader_ctocpp.h"
#include "libcef_dll/transfer_util.h" #include "libcef_dll/transfer_util.h"
@ -289,8 +293,8 @@ CEF_GLOBAL void CefShutdown() {
&CefRunContextMenuCallbackCToCpp::DebugObjCt)); &CefRunContextMenuCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero( DCHECK(base::AtomicRefCountIsZero(
&CefRunFileDialogCallbackCppToC::DebugObjCt)); &CefRunFileDialogCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLCertPrincipalCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLInfoCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefSSLInfoCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLStatusCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero( DCHECK(base::AtomicRefCountIsZero(
&CefSchemeHandlerFactoryCppToC::DebugObjCt)); &CefSchemeHandlerFactoryCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSchemeRegistrarCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefSchemeRegistrarCToCpp::DebugObjCt));
@ -323,6 +327,8 @@ CEF_GLOBAL void CefShutdown() {
DCHECK(base::AtomicRefCountIsZero(&CefWindowCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWindowCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefWindowDelegateCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWindowDelegateCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefWriteHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefWriteHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefX509CertPrincipalCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefX509CertificateCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefXmlReaderCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefXmlReaderCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefZipReaderCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefZipReaderCToCpp::DebugObjCt));
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
@ -730,6 +736,28 @@ CEF_GLOBAL bool CefClearSchemeHandlerFactories() {
return _retval?true:false; return _retval?true:false;
} }
CEF_GLOBAL bool CefIsCertStatusError(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_is_cert_status_error(
status);
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefIsCertStatusMinorError(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_is_cert_status_minor_error(
status);
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) { CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -100,8 +100,8 @@ enum CefWrapperType {
WT_RESPONSE_FILTER, WT_RESPONSE_FILTER,
WT_RUN_CONTEXT_MENU_CALLBACK, WT_RUN_CONTEXT_MENU_CALLBACK,
WT_RUN_FILE_DIALOG_CALLBACK, WT_RUN_FILE_DIALOG_CALLBACK,
WT_SSLCERT_PRINCIPAL,
WT_SSLINFO, WT_SSLINFO,
WT_SSLSTATUS,
WT_SCHEME_HANDLER_FACTORY, WT_SCHEME_HANDLER_FACTORY,
WT_SCHEME_REGISTRAR, WT_SCHEME_REGISTRAR,
WT_SCROLL_VIEW, WT_SCROLL_VIEW,
@ -137,6 +137,8 @@ enum CefWrapperType {
WT_WINDOW, WT_WINDOW,
WT_WINDOW_DELEGATE, WT_WINDOW_DELEGATE,
WT_WRITE_HANDLER, WT_WRITE_HANDLER,
WT_X509CERT_PRINCIPAL,
WT_X509CERTIFICATE,
WT_XML_READER, WT_XML_READER,
WT_ZIP_READER, WT_ZIP_READER,
}; };

View File

@ -14,6 +14,8 @@
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/cef_parser.h" #include "include/cef_parser.h"
#include "include/cef_ssl_status.h"
#include "include/cef_x509_certificate.h"
#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_closure_task.h"
#include "cefclient/browser/main_context.h" #include "cefclient/browser/main_context.h"
#include "cefclient/browser/resource_util.h" #include "cefclient/browser/resource_util.h"
@ -36,6 +38,7 @@ enum client_menu_ids {
CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST, CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST,
CLIENT_ID_CLOSE_DEVTOOLS, CLIENT_ID_CLOSE_DEVTOOLS,
CLIENT_ID_INSPECT_ELEMENT, CLIENT_ID_INSPECT_ELEMENT,
CLIENT_ID_SHOW_SSL_INFO,
CLIENT_ID_TESTMENU_SUBMENU, CLIENT_ID_TESTMENU_SUBMENU,
CLIENT_ID_TESTMENU_CHECKITEM, CLIENT_ID_TESTMENU_CHECKITEM,
CLIENT_ID_TESTMENU_RADIOITEM1, CLIENT_ID_TESTMENU_RADIOITEM1,
@ -82,8 +85,10 @@ std::string GetBinaryString(CefRefPtr<CefBinaryValue> value) {
return CefBase64Encode(src.data(), src.size()); return CefBase64Encode(src.data(), src.size());
} }
std::string GetCertStatusString(cef_cert_status_t status) {
#define FLAG(flag) if (status & flag) result += std::string(#flag) + "<br/>" #define FLAG(flag) if (status & flag) result += std::string(#flag) + "<br/>"
#define VALUE(val,def) if (val == def) return std::string(#def)
std::string GetCertStatusString(cef_cert_status_t status) {
std::string result; std::string result;
FLAG(CERT_STATUS_COMMON_NAME_INVALID); FLAG(CERT_STATUS_COMMON_NAME_INVALID);
@ -109,6 +114,29 @@ std::string GetCertStatusString(cef_cert_status_t status) {
return result; return result;
} }
std::string GetSSLVersionString(cef_ssl_version_t version) {
VALUE(version, SSL_CONNECTION_VERSION_UNKNOWN);
VALUE(version, SSL_CONNECTION_VERSION_SSL2);
VALUE(version, SSL_CONNECTION_VERSION_SSL3);
VALUE(version, SSL_CONNECTION_VERSION_TLS1);
VALUE(version, SSL_CONNECTION_VERSION_TLS1_1);
VALUE(version, SSL_CONNECTION_VERSION_TLS1_2);
VALUE(version, SSL_CONNECTION_VERSION_QUIC);
return std::string();
}
std::string GetContentStatusString(cef_ssl_content_status_t status) {
std::string result;
VALUE(status, SSL_CONTENT_NORMAL_CONTENT);
FLAG(SSL_CONTENT_DISPLAYED_INSECURE_CONTENT);
FLAG(SSL_CONTENT_RAN_INSECURE_CONTENT);
if (result.empty())
return "&nbsp;";
return result;
}
// Load a data: URI containing the error message. // Load a data: URI containing the error message.
void LoadErrorPage(CefRefPtr<CefFrame> frame, void LoadErrorPage(CefRefPtr<CefFrame> frame,
const std::string& failed_url, const std::string& failed_url,
@ -129,6 +157,58 @@ void LoadErrorPage(CefRefPtr<CefFrame> frame,
frame->LoadURL(test_runner::GetDataURI(ss.str(), "text/html")); frame->LoadURL(test_runner::GetDataURI(ss.str(), "text/html"));
} }
// Return HTML string with information about a certificate.
std::string GetCertificateInformation(CefRefPtr<CefX509Certificate> cert,
cef_cert_status_t certstatus) {
CefRefPtr<CefX509CertPrincipal> subject = cert->GetSubject();
CefRefPtr<CefX509CertPrincipal> issuer = cert->GetIssuer();
// Build a table showing certificate information. Various types of invalid
// certificates can be tested using https://badssl.com/.
std::stringstream ss;
ss << "<h3>X.509 Certificate Information:</h3>"
"<table border=1><tr><th>Field</th><th>Value</th></tr>";
if (certstatus != CERT_STATUS_NONE) {
ss << "<tr><td>Status</td><td>" <<
GetCertStatusString(certstatus) << "</td></tr>";
}
ss << "<tr><td>Subject</td><td>" <<
(subject.get() ? subject->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Issuer</td><td>" <<
(issuer.get() ? issuer->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Serial #*</td><td>" <<
GetBinaryString(cert->GetSerialNumber()) << "</td></tr>" <<
"<tr><td>Valid Start</td><td>" <<
GetTimeString(cert->GetValidStart()) << "</td></tr>"
"<tr><td>Valid Expiry</td><td>" <<
GetTimeString(cert->GetValidExpiry()) << "</td></tr>";
CefX509Certificate::IssuerChainBinaryList der_chain_list;
CefX509Certificate::IssuerChainBinaryList pem_chain_list;
cert->GetDEREncodedIssuerChain(der_chain_list);
cert->GetPEMEncodedIssuerChain(pem_chain_list);
DCHECK_EQ(der_chain_list.size(), pem_chain_list.size());
der_chain_list.insert(der_chain_list.begin(), cert->GetDEREncoded());
pem_chain_list.insert(pem_chain_list.begin(), cert->GetPEMEncoded());
for (size_t i = 0U; i < der_chain_list.size(); ++i) {
ss << "<tr><td>DER Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(der_chain_list[i]) << "</td></tr>"
"<tr><td>PEM Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(pem_chain_list[i]) << "</td></tr>";
}
ss << "</table> * Displayed value is base64 encoded.";
return ss.str();
}
} // namespace } // namespace
@ -237,6 +317,11 @@ void ClientHandler::OnBeforeContextMenu(
model->AddSeparator(); model->AddSeparator();
model->AddItem(CLIENT_ID_INSPECT_ELEMENT, "Inspect Element"); model->AddItem(CLIENT_ID_INSPECT_ELEMENT, "Inspect Element");
if (HasSSLInformation(browser)) {
model->AddSeparator();
model->AddItem(CLIENT_ID_SHOW_SSL_INFO, "Show SSL information");
}
// Test context menu features. // Test context menu features.
BuildTestMenu(model); BuildTestMenu(model);
} }
@ -260,6 +345,9 @@ bool ClientHandler::OnContextMenuCommand(
case CLIENT_ID_INSPECT_ELEMENT: case CLIENT_ID_INSPECT_ELEMENT:
ShowDevTools(browser, CefPoint(params->GetXCoord(), params->GetYCoord())); ShowDevTools(browser, CefPoint(params->GetXCoord(), params->GetYCoord()));
return true; return true;
case CLIENT_ID_SHOW_SSL_INFO:
ShowSSLInformation(browser);
return true;
default: // Allow default handling, if any. default: // Allow default handling, if any.
return ExecuteTestMenu(command_id); return ExecuteTestMenu(command_id);
} }
@ -602,51 +690,12 @@ bool ClientHandler::OnCertificateError(
CefRefPtr<CefRequestCallback> callback) { CefRefPtr<CefRequestCallback> callback) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefSSLCertPrincipal> subject = ssl_info->GetSubject(); CefRefPtr<CefX509Certificate> cert = ssl_info->GetX509Certificate();
CefRefPtr<CefSSLCertPrincipal> issuer = ssl_info->GetIssuer(); if (cert.get()) {
// Build a table showing certificate information. Various types of invalid
// certificates can be tested using https://badssl.com/.
std::stringstream ss;
ss << "X.509 Certificate Information:"
"<table border=1><tr><th>Field</th><th>Value</th></tr>" <<
"<tr><td>Subject</td><td>" <<
(subject.get() ? subject->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Issuer</td><td>" <<
(issuer.get() ? issuer->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Serial #*</td><td>" <<
GetBinaryString(ssl_info->GetSerialNumber()) << "</td></tr>"
"<tr><td>Status</td><td>" <<
GetCertStatusString(ssl_info->GetCertStatus()) << "</td></tr>"
"<tr><td>Valid Start</td><td>" <<
GetTimeString(ssl_info->GetValidStart()) << "</td></tr>"
"<tr><td>Valid Expiry</td><td>" <<
GetTimeString(ssl_info->GetValidExpiry()) << "</td></tr>";
CefSSLInfo::IssuerChainBinaryList der_chain_list;
CefSSLInfo::IssuerChainBinaryList pem_chain_list;
ssl_info->GetDEREncodedIssuerChain(der_chain_list);
ssl_info->GetPEMEncodedIssuerChain(pem_chain_list);
DCHECK_EQ(der_chain_list.size(), pem_chain_list.size());
der_chain_list.insert(der_chain_list.begin(), ssl_info->GetDEREncoded());
pem_chain_list.insert(pem_chain_list.begin(), ssl_info->GetPEMEncoded());
for (size_t i = 0U; i < der_chain_list.size(); ++i) {
ss << "<tr><td>DER Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(der_chain_list[i]) << "</td></tr>"
"<tr><td>PEM Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(pem_chain_list[i]) << "</td></tr>";
}
ss << "</table> * Displayed value is base64 encoded.";
// Load the error page. // Load the error page.
LoadErrorPage(browser->GetMainFrame(), request_url, cert_error, ss.str()); LoadErrorPage(browser->GetMainFrame(), request_url, cert_error,
GetCertificateInformation(cert, ssl_info->GetCertStatus()));
}
return false; // Cancel the request. return false; // Cancel the request.
} }
@ -724,6 +773,56 @@ void ClientHandler::CloseDevTools(CefRefPtr<CefBrowser> browser) {
browser->GetHost()->CloseDevTools(); browser->GetHost()->CloseDevTools();
} }
bool ClientHandler::HasSSLInformation(CefRefPtr<CefBrowser> browser) {
CefRefPtr<CefNavigationEntry> nav =
browser->GetHost()->GetVisibleNavigationEntry();
return (nav && nav->GetSSLStatus() &&
nav->GetSSLStatus()->IsSecureConnection());
}
void ClientHandler::ShowSSLInformation(CefRefPtr<CefBrowser> browser) {
std::stringstream ss;
CefRefPtr<CefNavigationEntry> nav =
browser->GetHost()->GetVisibleNavigationEntry();
if (!nav)
return;
CefRefPtr<CefSSLStatus> ssl = nav->GetSSLStatus();
if (!ssl)
return;
ss << "<html><head><title>SSL Information</title></head>"
"<body bgcolor=\"white\">"
"<h3>SSL Connection</h3>" <<
"<table border=1><tr><th>Field</th><th>Value</th></tr>";
CefURLParts urlparts;
if (CefParseURL(nav->GetURL(), urlparts)) {
CefString port(&urlparts.port);
ss << "<tr><td>Server</td><td>" << CefString(&urlparts.host).ToString();
if (!port.empty())
ss << ":" << port.ToString();
ss << "</td></tr>";
}
ss << "<tr><td>SSL Version</td><td>" <<
GetSSLVersionString(ssl->GetSSLVersion()) << "</td></tr>";
ss << "<tr><td>Content Status</td><td>" <<
GetContentStatusString(ssl->GetContentStatus()) << "</td></tr>";
ss << "</table>";
CefRefPtr<CefX509Certificate> cert = ssl->GetX509Certificate();
if (cert.get())
ss << GetCertificateInformation(cert, ssl->GetCertStatus());
ss << "</body></html>";
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(
false, is_osr(), CefRect(),
test_runner::GetDataURI(ss.str(), "text/html"));
}
bool ClientHandler::CreatePopupWindow( bool ClientHandler::CreatePopupWindow(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,

View File

@ -266,6 +266,12 @@ class ClientHandler : public CefClient,
// Close the existing DevTools popup window, if any. // Close the existing DevTools popup window, if any.
void CloseDevTools(CefRefPtr<CefBrowser> browser); void CloseDevTools(CefRefPtr<CefBrowser> browser);
// Test if the current site has SSL information available.
bool HasSSLInformation(CefRefPtr<CefBrowser> browser);
// Show SSL information for the current site.
void ShowSSLInformation(CefRefPtr<CefBrowser> browser);
// Returns the Delegate. // Returns the Delegate.
Delegate* delegate() const { return delegate_; } Delegate* delegate() const { return delegate_; }