Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/ssl/ssl_policy_backend.h" | 5 #include "content/browser/ssl/ssl_policy_backend.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/navigation_controller_impl.h" | 7 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/ssl_host_state_delegate.h" | 9 #include "content/public/browser/ssl_host_state_delegate.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host, | 26 bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host, |
| 27 int pid) const { | 27 int pid) const { |
| 28 if (!ssl_host_state_delegate_) | 28 if (!ssl_host_state_delegate_) |
| 29 return false; | 29 return false; |
| 30 | 30 |
| 31 return ssl_host_state_delegate_->DidHostRunInsecureContent(host, pid); | 31 return ssl_host_state_delegate_->DidHostRunInsecureContent(host, pid); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void SSLPolicyBackend::DenyCertForHost(net::X509Certificate* cert, | |
| 35 const std::string& host, | |
| 36 net::CertStatus error) { | |
| 37 if (ssl_host_state_delegate_) | |
| 38 ssl_host_state_delegate_->DenyCert(host, cert, error); | |
| 39 } | |
| 40 | |
| 41 void SSLPolicyBackend::AllowCertForHost(net::X509Certificate* cert, | 34 void SSLPolicyBackend::AllowCertForHost(net::X509Certificate* cert, |
| 42 const std::string& host, | 35 const std::string& host, |
| 43 net::CertStatus error) { | 36 net::CertStatus error) { |
| 44 if (ssl_host_state_delegate_) | 37 if (ssl_host_state_delegate_) |
| 45 ssl_host_state_delegate_->AllowCert(host, cert, error); | 38 ssl_host_state_delegate_->AllowCert(host, cert, error); |
| 46 } | 39 } |
| 47 | 40 |
| 48 net::CertPolicy::Judgment SSLPolicyBackend::QueryPolicy( | 41 net::CertPolicy::Judgment SSLPolicyBackend::QueryPolicy( |
| 49 net::X509Certificate* cert, | 42 net::X509Certificate* cert, |
| 50 const std::string& host, | 43 const std::string& host, |
| 51 net::CertStatus error, | 44 net::CertStatus error, |
| 52 bool* expired_previous_decision) { | 45 bool* expired_previous_decision) { |
| 53 if (!ssl_host_state_delegate_) | 46 if (!ssl_host_state_delegate_) |
|
Peter Kasting
2014/08/22 00:57:53
Nit: This whole function could just be:
return
jww
2014/08/22 03:49:35
Done.
| |
| 54 return net::CertPolicy::UNKNOWN; | 47 return net::CertPolicy::UNKNOWN; |
| 55 | 48 |
| 56 return ssl_host_state_delegate_->QueryPolicy( | 49 net::CertPolicy::Judgment judgement = ssl_host_state_delegate_->QueryPolicy( |
| 57 host, cert, error, expired_previous_decision); | 50 host, cert, error, expired_previous_decision); |
| 51 // SSLHostStateDelegate guarantees that it will only return ALLOWED or UNKNOWN | |
| 52 // and this method promises the same so check that before returning. | |
| 53 DCHECK(judgement == net::CertPolicy::ALLOWED || | |
| 54 judgement == net::CertPolicy::UNKNOWN); | |
| 55 return judgement; | |
| 58 } | 56 } |
| 59 | 57 |
| 60 } // namespace content | 58 } // namespace content |
| OLD | NEW |