Add CefRequestHandler::OnCertificateError() callback (issue #345).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1176 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-04-04 17:50:35 +00:00
parent bba0221e23
commit 9e0ba3801e
14 changed files with 387 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2013 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/allow_certificate_error_callback_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefAllowCertificateErrorCallbackCToCpp::Continue(bool allow) {
if (CEF_MEMBER_MISSING(struct_, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->cont(struct_,
allow);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefAllowCertificateErrorCallbackCToCpp,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,45 @@
// Copyright (c) 2013 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_ALLOW_CERTIFICATE_ERROR_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_ALLOW_CERTIFICATE_ERROR_CALLBACK_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_request_handler.h"
#include "include/capi/cef_request_handler_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 CefAllowCertificateErrorCallbackCToCpp
: public CefCToCpp<CefAllowCertificateErrorCallbackCToCpp,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t> {
public:
explicit CefAllowCertificateErrorCallbackCToCpp(
cef_allow_certificate_error_callback_t* str)
: CefCToCpp<CefAllowCertificateErrorCallbackCToCpp,
CefAllowCertificateErrorCallback,
cef_allow_certificate_error_callback_t>(str) {}
virtual ~CefAllowCertificateErrorCallbackCToCpp() {}
// CefAllowCertificateErrorCallback methods
virtual void Continue(bool allow) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_ALLOW_CERTIFICATE_ERROR_CALLBACK_CTOCPP_H_

View File

@@ -10,6 +10,7 @@
// for more information.
//
#include "libcef_dll/cpptoc/allow_certificate_error_callback_cpptoc.h"
#include "libcef_dll/cpptoc/auth_callback_cpptoc.h"
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
@@ -274,6 +275,33 @@ bool CefRequestHandlerCToCpp::OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
return _retval?true:false;
}
bool CefRequestHandlerCToCpp::OnCertificateError(cef_errorcode_t cert_error,
const CefString& request_url,
CefRefPtr<CefAllowCertificateErrorCallback> callback) {
if (CEF_MEMBER_MISSING(struct_, on_certificate_error))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: request_url; type: string_byref_const
DCHECK(!request_url.empty());
if (request_url.empty())
return false;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return false;
// Execute
int _retval = struct_->on_certificate_error(struct_,
cert_error,
request_url.GetStruct(),
CefAllowCertificateErrorCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,

View File

@@ -56,6 +56,9 @@ class CefRequestHandlerCToCpp
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
const CefString& url, const CefString& policy_url,
CefRefPtr<CefWebPluginInfo> info) OVERRIDE;
virtual bool OnCertificateError(cef_errorcode_t cert_error,
const CefString& request_url,
CefRefPtr<CefAllowCertificateErrorCallback> callback) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED