2016-09-02 12:01:33 +02:00
|
|
|
// Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
|
2015-02-11 19:15:04 +01:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/libcef/browser/x509_cert_principal_impl.h"
|
2015-02-11 19:15:04 +01:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
void TransferVector(const std::vector<std::string>& source,
|
|
|
|
std::vector<CefString>& target) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!target.empty()) {
|
2015-02-11 19:15:04 +01:00
|
|
|
target.clear();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-02-11 19:15:04 +01:00
|
|
|
|
|
|
|
if (!source.empty()) {
|
|
|
|
std::vector<std::string>::const_iterator it = source.begin();
|
2023-01-02 23:59:03 +01:00
|
|
|
for (; it != source.end(); ++it) {
|
2015-02-11 19:15:04 +01:00
|
|
|
target.push_back(*it);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-02-11 19:15:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefX509CertPrincipalImpl::CefX509CertPrincipalImpl(
|
2015-02-11 19:15:04 +01:00
|
|
|
const net::CertPrincipal& value)
|
2017-05-17 11:29:28 +02:00
|
|
|
: value_(value) {}
|
2015-02-11 19:15:04 +01:00
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetDisplayName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.GetDisplayName();
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetCommonName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.common_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetLocalityName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.locality_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetStateOrProvinceName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.state_or_province_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetCountryName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.country_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetOrganizationNames(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& names) {
|
|
|
|
TransferVector(value_.organization_names, names);
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetOrganizationUnitNames(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& names) {
|
|
|
|
TransferVector(value_.organization_unit_names, names);
|
|
|
|
}
|