mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Pass SSL certificate information to CefRequestHandler::OnCertificateError via a new CefSSLInfo interface (issue #1530).
- cefclient: Improve error message text and use a data: URI instead of LoadString for loading error messages (issue #579). - Add functions in cef_url.h for base64 and URI encoding/decoding (issue #579). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2272@2029 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/quota_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
|
||||
@ -252,18 +253,27 @@ void CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
allow_os_execution = allow_os_executionInt?true:false;
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnCertificateError(cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
bool CefRequestHandlerCToCpp::OnCertificateError(CefRefPtr<CefBrowser> browser,
|
||||
cef_errorcode_t cert_error, const CefString& request_url,
|
||||
CefRefPtr<CefSSLInfo> ssl_info,
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_certificate_error))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: request_url; type: string_byref_const
|
||||
DCHECK(!request_url.empty());
|
||||
if (request_url.empty())
|
||||
return false;
|
||||
// Verify param: ssl_info; type: refptr_diff
|
||||
DCHECK(ssl_info.get());
|
||||
if (!ssl_info.get())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
@ -271,8 +281,10 @@ bool CefRequestHandlerCToCpp::OnCertificateError(cef_errorcode_t cert_error,
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_certificate_error(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
cert_error,
|
||||
request_url.GetStruct(),
|
||||
CefSSLInfoCppToC::Wrap(ssl_info),
|
||||
CefAllowCertificateErrorCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
|
@ -52,8 +52,9 @@ class CefRequestHandlerCToCpp
|
||||
CefRefPtr<CefQuotaCallback> callback) override;
|
||||
void OnProtocolExecution(CefRefPtr<CefBrowser> browser, const CefString& url,
|
||||
bool& allow_os_execution) override;
|
||||
bool OnCertificateError(cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
bool OnCertificateError(CefRefPtr<CefBrowser> browser,
|
||||
cef_errorcode_t cert_error, const CefString& request_url,
|
||||
CefRefPtr<CefSSLInfo> ssl_info,
|
||||
CefRefPtr<CefAllowCertificateErrorCallback> callback) override;
|
||||
bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser, const CefString& url,
|
||||
const CefString& policy_url, CefRefPtr<CefWebPluginInfo> info) override;
|
||||
|
199
libcef_dll/ctocpp/sslcert_principal_ctocpp.cc
Normal file
199
libcef_dll/ctocpp/sslcert_principal_ctocpp.cc
Normal file
@ -0,0 +1,199 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefString CefSSLCertPrincipalCToCpp::GetDisplayName() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_display_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = struct_->get_display_name(struct_);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
CefString CefSSLCertPrincipalCToCpp::GetCommonName() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_common_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = struct_->get_common_name(struct_);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
CefString CefSSLCertPrincipalCToCpp::GetLocalityName() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_locality_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = struct_->get_locality_name(struct_);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
CefString CefSSLCertPrincipalCToCpp::GetStateOrProvinceName() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_state_or_province_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = struct_->get_state_or_province_name(struct_);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
CefString CefSSLCertPrincipalCToCpp::GetCountryName() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_country_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = struct_->get_country_name(struct_);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
void CefSSLCertPrincipalCToCpp::GetStreetAddresses(
|
||||
std::vector<CefString>& addresses) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_street_addresses))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: addresses; type: string_vec_byref
|
||||
cef_string_list_t addressesList = cef_string_list_alloc();
|
||||
DCHECK(addressesList);
|
||||
if (addressesList)
|
||||
transfer_string_list_contents(addresses, addressesList);
|
||||
|
||||
// Execute
|
||||
struct_->get_street_addresses(struct_,
|
||||
addressesList);
|
||||
|
||||
// Restore param:addresses; type: string_vec_byref
|
||||
if (addressesList) {
|
||||
addresses.clear();
|
||||
transfer_string_list_contents(addressesList, addresses);
|
||||
cef_string_list_free(addressesList);
|
||||
}
|
||||
}
|
||||
|
||||
void CefSSLCertPrincipalCToCpp::GetOrganizationNames(
|
||||
std::vector<CefString>& names) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_organization_names))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: names; type: string_vec_byref
|
||||
cef_string_list_t namesList = cef_string_list_alloc();
|
||||
DCHECK(namesList);
|
||||
if (namesList)
|
||||
transfer_string_list_contents(names, namesList);
|
||||
|
||||
// Execute
|
||||
struct_->get_organization_names(struct_,
|
||||
namesList);
|
||||
|
||||
// Restore param:names; type: string_vec_byref
|
||||
if (namesList) {
|
||||
names.clear();
|
||||
transfer_string_list_contents(namesList, names);
|
||||
cef_string_list_free(namesList);
|
||||
}
|
||||
}
|
||||
|
||||
void CefSSLCertPrincipalCToCpp::GetOrganizationUnitNames(
|
||||
std::vector<CefString>& names) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_organization_unit_names))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: names; type: string_vec_byref
|
||||
cef_string_list_t namesList = cef_string_list_alloc();
|
||||
DCHECK(namesList);
|
||||
if (namesList)
|
||||
transfer_string_list_contents(names, namesList);
|
||||
|
||||
// Execute
|
||||
struct_->get_organization_unit_names(struct_,
|
||||
namesList);
|
||||
|
||||
// Restore param:names; type: string_vec_byref
|
||||
if (namesList) {
|
||||
names.clear();
|
||||
transfer_string_list_contents(namesList, names);
|
||||
cef_string_list_free(namesList);
|
||||
}
|
||||
}
|
||||
|
||||
void CefSSLCertPrincipalCToCpp::GetDomainComponents(
|
||||
std::vector<CefString>& components) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_domain_components))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: components; type: string_vec_byref
|
||||
cef_string_list_t componentsList = cef_string_list_alloc();
|
||||
DCHECK(componentsList);
|
||||
if (componentsList)
|
||||
transfer_string_list_contents(components, componentsList);
|
||||
|
||||
// Execute
|
||||
struct_->get_domain_components(struct_,
|
||||
componentsList);
|
||||
|
||||
// Restore param:components; type: string_vec_byref
|
||||
if (componentsList) {
|
||||
components.clear();
|
||||
transfer_string_list_contents(componentsList, components);
|
||||
cef_string_list_free(componentsList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> base::AtomicRefCount CefCToCpp<CefSSLCertPrincipalCToCpp,
|
||||
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
50
libcef_dll/ctocpp/sslcert_principal_ctocpp.h
Normal file
50
libcef_dll/ctocpp/sslcert_principal_ctocpp.h
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef USING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||
#else // USING_CEF_SHARED
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_ssl_info.h"
|
||||
#include "include/capi/cef_ssl_info_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 CefSSLCertPrincipalCToCpp
|
||||
: public CefCToCpp<CefSSLCertPrincipalCToCpp, CefSSLCertPrincipal,
|
||||
cef_sslcert_principal_t> {
|
||||
public:
|
||||
explicit CefSSLCertPrincipalCToCpp(cef_sslcert_principal_t* str)
|
||||
: CefCToCpp<CefSSLCertPrincipalCToCpp, CefSSLCertPrincipal,
|
||||
cef_sslcert_principal_t>(str) {}
|
||||
|
||||
// CefSSLCertPrincipal methods
|
||||
virtual CefString GetDisplayName() OVERRIDE;
|
||||
virtual CefString GetCommonName() OVERRIDE;
|
||||
virtual CefString GetLocalityName() OVERRIDE;
|
||||
virtual CefString GetStateOrProvinceName() OVERRIDE;
|
||||
virtual CefString GetCountryName() OVERRIDE;
|
||||
virtual void GetStreetAddresses(std::vector<CefString>& addresses) OVERRIDE;
|
||||
virtual void GetOrganizationNames(std::vector<CefString>& names) OVERRIDE;
|
||||
virtual void GetOrganizationUnitNames(std::vector<CefString>& names) OVERRIDE;
|
||||
virtual void GetDomainComponents(std::vector<CefString>& components) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_SSLCERT_PRINCIPAL_CTOCPP_H_
|
||||
|
116
libcef_dll/ctocpp/sslinfo_ctocpp.cc
Normal file
116
libcef_dll/ctocpp/sslinfo_ctocpp.cc
Normal file
@ -0,0 +1,116 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/binary_value_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoCToCpp::GetSubject() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_subject))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_sslcert_principal_t* _retval = struct_->get_subject(struct_);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefSSLCertPrincipalCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoCToCpp::GetIssuer() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> base::AtomicRefCount CefCToCpp<CefSSLInfoCToCpp, CefSSLInfo,
|
||||
cef_sslinfo_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
45
libcef_dll/ctocpp/sslinfo_ctocpp.h
Normal file
45
libcef_dll/ctocpp/sslinfo_ctocpp.h
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_SSLINFO_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_SSLINFO_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_info.h"
|
||||
#include "include/capi/cef_ssl_info_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 CefSSLInfoCToCpp
|
||||
: public CefCToCpp<CefSSLInfoCToCpp, CefSSLInfo, cef_sslinfo_t> {
|
||||
public:
|
||||
explicit CefSSLInfoCToCpp(cef_sslinfo_t* str)
|
||||
: CefCToCpp<CefSSLInfoCToCpp, CefSSLInfo, cef_sslinfo_t>(str) {}
|
||||
|
||||
// CefSSLInfo methods
|
||||
virtual CefRefPtr<CefSSLCertPrincipal> GetSubject() OVERRIDE;
|
||||
virtual CefRefPtr<CefSSLCertPrincipal> GetIssuer() OVERRIDE;
|
||||
virtual CefRefPtr<CefBinaryValue> GetSerialNumber() OVERRIDE;
|
||||
virtual CefTime GetValidStart() OVERRIDE;
|
||||
virtual CefTime GetValidExpiry() OVERRIDE;
|
||||
virtual CefRefPtr<CefBinaryValue> GetDEREncoded() OVERRIDE;
|
||||
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_SSLINFO_CTOCPP_H_
|
||||
|
Reference in New Issue
Block a user