OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 5 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/cert/caching_cert_verifier.h" |
11 #include "net/cert/cert_verify_proc.h" | 12 #include "net/cert/cert_verify_proc.h" |
12 #include "net/cert/multi_threaded_cert_verifier.h" | 13 #include "net/cert/multi_threaded_cert_verifier.h" |
13 | 14 |
14 namespace policy { | 15 namespace policy { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 void MaybeSignalAnchorUse(int error, | 19 void MaybeSignalAnchorUse(int error, |
19 const base::Closure& anchor_used_callback, | 20 const base::Closure& anchor_used_callback, |
20 const net::CertVerifyResult& verify_result) { | 21 const net::CertVerifyResult& verify_result) { |
(...skipping 28 matching lines...) Expand all Loading... |
49 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 50 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
50 } | 51 } |
51 | 52 |
52 void PolicyCertVerifier::InitializeOnIOThread( | 53 void PolicyCertVerifier::InitializeOnIOThread( |
53 const scoped_refptr<net::CertVerifyProc>& verify_proc) { | 54 const scoped_refptr<net::CertVerifyProc>& verify_proc) { |
54 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 55 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
55 if (!verify_proc->SupportsAdditionalTrustAnchors()) { | 56 if (!verify_proc->SupportsAdditionalTrustAnchors()) { |
56 LOG(WARNING) | 57 LOG(WARNING) |
57 << "Additional trust anchors not supported on the current platform!"; | 58 << "Additional trust anchors not supported on the current platform!"; |
58 } | 59 } |
59 net::MultiThreadedCertVerifier* verifier = | 60 std::unique_ptr<net::CachingCertVerifier> verifier = |
60 new net::MultiThreadedCertVerifier(verify_proc.get()); | 61 base::MakeUnique<net::CachingCertVerifier>( |
| 62 base::MakeUnique<MultiThreadedCertVerifier>(verify_proc.get())); |
61 verifier->SetCertTrustAnchorProvider(this); | 63 verifier->SetCertTrustAnchorProvider(this); |
62 delegate_.reset(verifier); | 64 delegate_ = std::move(verifier); |
63 } | 65 } |
64 | 66 |
65 void PolicyCertVerifier::SetTrustAnchors( | 67 void PolicyCertVerifier::SetTrustAnchors( |
66 const net::CertificateList& trust_anchors) { | 68 const net::CertificateList& trust_anchors) { |
67 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 69 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
68 trust_anchors_ = trust_anchors; | 70 trust_anchors_ = trust_anchors; |
69 } | 71 } |
70 | 72 |
71 int PolicyCertVerifier::Verify( | 73 int PolicyCertVerifier::Verify( |
72 const RequestParams& params, | 74 const RequestParams& params, |
(...skipping 19 matching lines...) Expand all Loading... |
92 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 94 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
93 return delegate_->SupportsOCSPStapling(); | 95 return delegate_->SupportsOCSPStapling(); |
94 } | 96 } |
95 | 97 |
96 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { | 98 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { |
97 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 99 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
98 return trust_anchors_; | 100 return trust_anchors_; |
99 } | 101 } |
100 | 102 |
101 } // namespace policy | 103 } // namespace policy |
OLD | NEW |