1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/web/public/certificate_policy_cache.h"
7 #include "base/logging.h"
8 #include "ios/web/public/web_thread.h"
12 CertificatePolicyCache::CertificatePolicyCache() {
15 CertificatePolicyCache::~CertificatePolicyCache() {
18 void CertificatePolicyCache::AllowCertForHost(net::X509Certificate
* cert
,
19 const std::string
& host
,
20 net::CertStatus error
) {
21 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::IO
);
22 cert_policy_for_host_
[host
].Allow(cert
, error
);
25 CertPolicy::Judgment
CertificatePolicyCache::QueryPolicy(
26 net::X509Certificate
* cert
,
27 const std::string
& host
,
28 net::CertStatus error
) {
29 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::IO
);
30 return cert_policy_for_host_
[host
].Check(cert
, error
);
33 void CertificatePolicyCache::ClearCertificatePolicies() {
34 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::IO
);
35 cert_policy_for_host_
.clear();