| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/ssl/ssl_host_state.h" | 5 #include "chrome/browser/ssl/ssl_host_state.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SSLHostState::AllowCertForHost(net::X509Certificate* cert, | 51 void SSLHostState::AllowCertForHost(net::X509Certificate* cert, |
| 52 const std::string& host) { | 52 const std::string& host) { |
| 53 DCHECK(CalledOnValidThread()); | 53 DCHECK(CalledOnValidThread()); |
| 54 | 54 |
| 55 // Remember that we do like this cert for this host. | 55 // Remember that we do like this cert for this host. |
| 56 cert_policy_for_host_[host].Allow(cert); | 56 cert_policy_for_host_[host].Allow(cert); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool SSLHostState::DidAllowCertForHost(const std::string& host) { | |
| 60 DCHECK(CalledOnValidThread()); | |
| 61 | |
| 62 std::map<std::string, net::X509Certificate::Policy>::const_iterator iter = | |
| 63 cert_policy_for_host_.find(host); | |
| 64 | |
| 65 if (iter == cert_policy_for_host_.end()) | |
| 66 return false; | |
| 67 | |
| 68 return iter->second.HasAllowedCert(); | |
| 69 } | |
| 70 | |
| 71 net::X509Certificate::Policy::Judgment SSLHostState::QueryPolicy( | 59 net::X509Certificate::Policy::Judgment SSLHostState::QueryPolicy( |
| 72 net::X509Certificate* cert, const std::string& host) { | 60 net::X509Certificate* cert, const std::string& host) { |
| 73 DCHECK(CalledOnValidThread()); | 61 DCHECK(CalledOnValidThread()); |
| 74 | 62 |
| 75 return cert_policy_for_host_[host].Check(cert); | 63 return cert_policy_for_host_[host].Check(cert); |
| 76 } | 64 } |
| 77 | 65 |
| 78 void SSLHostState::AllowMixedContentForHost(const std::string& host) { | 66 void SSLHostState::AllowMixedContentForHost(const std::string& host) { |
| 79 DCHECK(CalledOnValidThread()); | 67 DCHECK(CalledOnValidThread()); |
| 80 | 68 |
| 81 allow_mixed_content_for_host_.insert(host); | 69 allow_mixed_content_for_host_.insert(host); |
| 82 } | 70 } |
| 83 | 71 |
| 84 bool SSLHostState::DidAllowMixedContentForHost(const std::string& host) { | 72 bool SSLHostState::DidAllowMixedContentForHost(const std::string& host) { |
| 85 DCHECK(CalledOnValidThread()); | 73 DCHECK(CalledOnValidThread()); |
| 86 | 74 |
| 87 return (allow_mixed_content_for_host_.find(host) != | 75 return (allow_mixed_content_for_host_.find(host) != |
| 88 allow_mixed_content_for_host_.end()); | 76 allow_mixed_content_for_host_.end()); |
| 89 } | 77 } |
| OLD | NEW |