| 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 "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/cert/caching_cert_verifier.h" |
| 11 #include "net/cert/cert_verify_proc.h" | 13 #include "net/cert/cert_verify_proc.h" |
| 12 #include "net/cert/multi_threaded_cert_verifier.h" | 14 #include "net/cert/multi_threaded_cert_verifier.h" |
| 13 | 15 |
| 14 namespace policy { | 16 namespace policy { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 void MaybeSignalAnchorUse(int error, | 20 void MaybeSignalAnchorUse(int error, |
| 19 const base::Closure& anchor_used_callback, | 21 const base::Closure& anchor_used_callback, |
| 20 const net::CertVerifyResult& verify_result) { | 22 const net::CertVerifyResult& verify_result) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 51 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void PolicyCertVerifier::InitializeOnIOThread( | 54 void PolicyCertVerifier::InitializeOnIOThread( |
| 53 const scoped_refptr<net::CertVerifyProc>& verify_proc) { | 55 const scoped_refptr<net::CertVerifyProc>& verify_proc) { |
| 54 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 56 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 55 if (!verify_proc->SupportsAdditionalTrustAnchors()) { | 57 if (!verify_proc->SupportsAdditionalTrustAnchors()) { |
| 56 LOG(WARNING) | 58 LOG(WARNING) |
| 57 << "Additional trust anchors not supported on the current platform!"; | 59 << "Additional trust anchors not supported on the current platform!"; |
| 58 } | 60 } |
| 59 net::MultiThreadedCertVerifier* verifier = | 61 std::unique_ptr<net::CachingCertVerifier> verifier = |
| 60 new net::MultiThreadedCertVerifier(verify_proc.get()); | 62 base::MakeUnique<net::CachingCertVerifier>( |
| 63 base::MakeUnique<net::MultiThreadedCertVerifier>(verify_proc.get())); |
| 61 verifier->SetCertTrustAnchorProvider(this); | 64 verifier->SetCertTrustAnchorProvider(this); |
| 62 delegate_.reset(verifier); | 65 delegate_ = std::move(verifier); |
| 63 } | 66 } |
| 64 | 67 |
| 65 void PolicyCertVerifier::SetTrustAnchors( | 68 void PolicyCertVerifier::SetTrustAnchors( |
| 66 const net::CertificateList& trust_anchors) { | 69 const net::CertificateList& trust_anchors) { |
| 67 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 70 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 68 trust_anchors_ = trust_anchors; | 71 trust_anchors_ = trust_anchors; |
| 69 } | 72 } |
| 70 | 73 |
| 71 int PolicyCertVerifier::Verify( | 74 int PolicyCertVerifier::Verify( |
| 72 const RequestParams& params, | 75 const RequestParams& params, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 92 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 95 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 93 return delegate_->SupportsOCSPStapling(); | 96 return delegate_->SupportsOCSPStapling(); |
| 94 } | 97 } |
| 95 | 98 |
| 96 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { | 99 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { |
| 97 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 100 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 98 return trust_anchors_; | 101 return trust_anchors_; |
| 99 } | 102 } |
| 100 | 103 |
| 101 } // namespace policy | 104 } // namespace policy |
| OLD | NEW |