diff options
Diffstat (limited to 'src/core/certificate_error_controller.h')
-rw-r--r-- | src/core/certificate_error_controller.h | 88 |
1 files changed, 32 insertions, 56 deletions
diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h index dc1c3cf54..ec3e26806 100644 --- a/src/core/certificate_error_controller.h +++ b/src/core/certificate_error_controller.h @@ -52,83 +52,59 @@ #define CERTIFICATE_ERROR_CONTROLLER_H #include "qtwebenginecoreglobal_p.h" - +#include "base/callback.h" +#include "content/public/browser/certificate_request_result_type.h" +#include "qwebenginecertificateerror.h" #include <QtCore/QDateTime> +#include <QtCore/QScopedPointer> #include <QtCore/QUrl> #include <QtNetwork/QSslCertificate> -QT_BEGIN_NAMESPACE +namespace net { +class SSLInfo; +} +class GURL; -class CertificateErrorControllerPrivate; +namespace QtWebEngineCore { class Q_WEBENGINECORE_PRIVATE_EXPORT CertificateErrorController { public: - CertificateErrorController(CertificateErrorControllerPrivate *p); + CertificateErrorController( + int cert_error, const net::SSLInfo &ssl_info, const GURL &request_url, + bool strict_enforcement, + base::OnceCallback<void(content::CertificateRequestResultType)> callback); ~CertificateErrorController(); - // We can't use QSslError::SslErrors, because the error categories doesn't map. - // Keep up to date with net/base/net_errors.h and net::IsCertificateError(): - enum CertificateError { - SslPinnedKeyNotInCertificateChain = -150, - CertificateCommonNameInvalid = -200, - CertificateDateInvalid = -201, - CertificateAuthorityInvalid = -202, - CertificateContainsErrors = -203, - CertificateNoRevocationMechanism = -204, - CertificateUnableToCheckRevocation = -205, - CertificateRevoked = -206, - CertificateInvalid = -207, - CertificateWeakSignatureAlgorithm = -208, - CertificateNonUniqueName = -210, - CertificateWeakKey = -211, - CertificateNameConstraintViolation = -212, - CertificateValidityTooLong = -213, - CertificateTransparencyRequired = -214, - CertificateSymantecLegacy = -215, - CertificateKnownInterceptionBlocked = -217, - CertificateErrorEnd = -218 // not an error, just an enum boundary - }; - - CertificateError error() const; + QWebEngineCertificateError::Type error() const; QUrl url() const; bool overridable() const; - bool strictEnforcement() const; QString errorString() const; - QDateTime validStart() const; QDateTime validExpiry() const; QList<QSslCertificate> certificateChain() const; + bool deferred() const; + void defer(); + + bool answered() const; void accept(bool); - // Note: The resource type should probably not be exported, since once accepted the certificate exception - // counts for all resource types. - // Keep up to date with webkit/common/resource_type.h - enum ResourceType { - ResourceTypeMainFrame = 0, // top level page - ResourceTypeSubFrame, // frame or iframe - ResourceTypeStylesheet, // a CSS stylesheet - ResourceTypeScript, // an external script - ResourceTypeImage, // an image (jpg/gif/png/etc) - ResourceTypeFont, // a font - ResourceTypeOther, // an "other" subresource. - ResourceTypeObject, // an object (or embed) tag for a plugin, - // or a resource that a plugin requested. - ResourceTypeMedia, // a media resource. - ResourceTypeWorker, // the main resource of a dedicated worker. - ResourceTypeSharedWorker, // the main resource of a shared worker. - ResourceTypePrefetch, // an explicitly requested prefetch - ResourceTypeFavicon, // a favicon - ResourceTypeXHR, // a XMLHttpRequest - ResourceTypePing, // a ping request for <a ping> - ResourceTypeServiceWorker, // the main resource of a service worker. - }; + void ignoreCertificateError() { accept(true); } + void rejectCertificate() { accept(false); } - ResourceType resourceType() const; + void deactivate(); + + QWebEngineCertificateError::Type m_certError; + const QUrl m_requestUrl; + QDateTime m_validExpiry; + bool m_overridable; + base::OnceCallback<void(content::CertificateRequestResultType)> m_callback; + QList<QSslCertificate> m_certificateChain; + + bool m_answered = false, m_deferred = false; private: - CertificateErrorControllerPrivate* d; + Q_DISABLE_COPY(CertificateErrorController) }; -QT_END_NAMESPACE - +} #endif // CERTIFICATE_ERROR_CONTROLLER_H |