2016-09-02 12:01:33 +02:00
|
|
|
// 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 "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));
|
2016-10-17 20:14:44 +02:00
|
|
|
certificate_ = value.certificate;
|
2016-09-02 12:01:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefSSLStatusImpl::IsSecureConnection() {
|
2016-10-17 20:14:44 +02:00
|
|
|
return !!certificate_.get();
|
2016-09-02 12:01:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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() {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (certificate_ && !cef_certificate_) {
|
2016-10-27 19:57:12 +02:00
|
|
|
cef_certificate_ = new CefX509CertificateImpl(certificate_);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-10-17 20:14:44 +02:00
|
|
|
return cef_certificate_;
|
2016-09-02 12:01:33 +02:00
|
|
|
}
|