| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/ssl/ssl_policy_backend.h" | |
| 6 | |
| 7 #include "content/browser/frame_host/navigation_controller_impl.h" | |
| 8 #include "content/public/browser/browser_context.h" | |
| 9 #include "content/public/browser/ssl_host_state_delegate.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 SSLPolicyBackend::SSLPolicyBackend(NavigationControllerImpl* controller) | |
| 14 : ssl_host_state_delegate_( | |
| 15 controller->GetBrowserContext()->GetSSLHostStateDelegate()), | |
| 16 controller_(controller) { | |
| 17 DCHECK(controller_); | |
| 18 } | |
| 19 | |
| 20 void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) { | |
| 21 if (ssl_host_state_delegate_) | |
| 22 ssl_host_state_delegate_->HostRanInsecureContent( | |
| 23 host, id, SSLHostStateDelegate::MIXED_CONTENT); | |
| 24 SSLManager::NotifySSLInternalStateChanged(controller_->GetBrowserContext()); | |
| 25 } | |
| 26 | |
| 27 bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host, | |
| 28 int pid) const { | |
| 29 if (!ssl_host_state_delegate_) | |
| 30 return false; | |
| 31 | |
| 32 return ssl_host_state_delegate_->DidHostRunInsecureContent( | |
| 33 host, pid, SSLHostStateDelegate::MIXED_CONTENT); | |
| 34 } | |
| 35 | |
| 36 void SSLPolicyBackend::HostRanContentWithCertErrors(const std::string& host, | |
| 37 int id) { | |
| 38 if (ssl_host_state_delegate_) | |
| 39 ssl_host_state_delegate_->HostRanInsecureContent( | |
| 40 host, id, SSLHostStateDelegate::CERT_ERRORS_CONTENT); | |
| 41 SSLManager::NotifySSLInternalStateChanged(controller_->GetBrowserContext()); | |
| 42 } | |
| 43 | |
| 44 bool SSLPolicyBackend::DidHostRunContentWithCertErrors(const std::string& host, | |
| 45 int pid) const { | |
| 46 if (!ssl_host_state_delegate_) | |
| 47 return false; | |
| 48 | |
| 49 return ssl_host_state_delegate_->DidHostRunInsecureContent( | |
| 50 host, pid, SSLHostStateDelegate::CERT_ERRORS_CONTENT); | |
| 51 } | |
| 52 | |
| 53 void SSLPolicyBackend::RevokeUserAllowExceptions(const std::string& host) { | |
| 54 if (!ssl_host_state_delegate_) | |
| 55 return; | |
| 56 | |
| 57 ssl_host_state_delegate_->RevokeUserAllowExceptions(host); | |
| 58 } | |
| 59 | |
| 60 bool SSLPolicyBackend::HasAllowException(const std::string& host) { | |
| 61 if (!ssl_host_state_delegate_) | |
| 62 return false; | |
| 63 | |
| 64 return ssl_host_state_delegate_->HasAllowException(host); | |
| 65 } | |
| 66 | |
| 67 void SSLPolicyBackend::AllowCertForHost(const net::X509Certificate& cert, | |
| 68 const std::string& host, | |
| 69 net::CertStatus error) { | |
| 70 if (ssl_host_state_delegate_) | |
| 71 ssl_host_state_delegate_->AllowCert(host, cert, error); | |
| 72 } | |
| 73 | |
| 74 SSLHostStateDelegate::CertJudgment SSLPolicyBackend::QueryPolicy( | |
| 75 const net::X509Certificate& cert, | |
| 76 const std::string& host, | |
| 77 net::CertStatus error, | |
| 78 bool* expired_previous_decision) { | |
| 79 return ssl_host_state_delegate_ ? | |
| 80 ssl_host_state_delegate_->QueryPolicy( | |
| 81 host, cert, error, expired_previous_decision) : | |
| 82 SSLHostStateDelegate::DENIED; | |
| 83 } | |
| 84 | |
| 85 } // namespace content | |
| OLD | NEW |