| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 PolicyCertVerifier::PolicyCertVerifier( | 42 PolicyCertVerifier::PolicyCertVerifier( |
| 43 const base::Closure& anchor_used_callback) | 43 const base::Closure& anchor_used_callback) |
| 44 : anchor_used_callback_(anchor_used_callback) { | 44 : anchor_used_callback_(anchor_used_callback) { |
| 45 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 45 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 PolicyCertVerifier::~PolicyCertVerifier() { | 48 PolicyCertVerifier::~PolicyCertVerifier() { |
| 49 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 49 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void PolicyCertVerifier::InitializeOnIOThread() { | 52 void PolicyCertVerifier::InitializeOnIOThread( |
| 53 const scoped_refptr<net::CertVerifyProc>& verify_proc) { |
| 53 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 54 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 54 scoped_refptr<net::CertVerifyProc> verify_proc = | |
| 55 net::CertVerifyProc::CreateDefault(); | |
| 56 if (!verify_proc->SupportsAdditionalTrustAnchors()) { | 55 if (!verify_proc->SupportsAdditionalTrustAnchors()) { |
| 57 LOG(WARNING) | 56 LOG(WARNING) |
| 58 << "Additional trust anchors not supported on the current platform!"; | 57 << "Additional trust anchors not supported on the current platform!"; |
| 59 } | 58 } |
| 60 net::MultiThreadedCertVerifier* verifier = | 59 net::MultiThreadedCertVerifier* verifier = |
| 61 new net::MultiThreadedCertVerifier(verify_proc.get()); | 60 new net::MultiThreadedCertVerifier(verify_proc); |
| 62 verifier->SetCertTrustAnchorProvider(this); | 61 verifier->SetCertTrustAnchorProvider(this); |
| 63 delegate_.reset(verifier); | 62 delegate_.reset(verifier); |
| 64 } | 63 } |
| 65 | 64 |
| 66 void PolicyCertVerifier::SetTrustAnchors( | 65 void PolicyCertVerifier::SetTrustAnchors( |
| 67 const net::CertificateList& trust_anchors) { | 66 const net::CertificateList& trust_anchors) { |
| 68 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 67 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 69 trust_anchors_ = trust_anchors; | 68 trust_anchors_ = trust_anchors; |
| 70 } | 69 } |
| 71 | 70 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 94 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 96 delegate_->CancelRequest(req); | 95 delegate_->CancelRequest(req); |
| 97 } | 96 } |
| 98 | 97 |
| 99 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { | 98 const net::CertificateList& PolicyCertVerifier::GetAdditionalTrustAnchors() { |
| 100 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 101 return trust_anchors_; | 100 return trust_anchors_; |
| 102 } | 101 } |
| 103 | 102 |
| 104 } // namespace policy | 103 } // namespace policy |
| OLD | NEW |