Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / content / browser / ssl / ssl_policy_backend.cc
bloba2626dac383d052c985b20d5d7fe6083907ba962
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.
5 #include "content/browser/ssl/ssl_policy_backend.h"
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"
11 namespace content {
13 SSLPolicyBackend::SSLPolicyBackend(NavigationControllerImpl* controller)
14 : ssl_host_state_delegate_(
15 controller->GetBrowserContext()->GetSSLHostStateDelegate()),
16 controller_(controller) {
17 DCHECK(controller_);
20 void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, int id) {
21 if (ssl_host_state_delegate_)
22 ssl_host_state_delegate_->HostRanInsecureContent(host, id);
23 SSLManager::NotifySSLInternalStateChanged(controller_->GetBrowserContext());
26 bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host,
27 int pid) const {
28 if (!ssl_host_state_delegate_)
29 return false;
31 return ssl_host_state_delegate_->DidHostRunInsecureContent(host, pid);
34 void SSLPolicyBackend::RevokeUserAllowExceptions(const std::string& host) {
35 if (!ssl_host_state_delegate_)
36 return;
38 ssl_host_state_delegate_->RevokeUserAllowExceptions(host);
41 bool SSLPolicyBackend::HasAllowException(const std::string& host) {
42 if (!ssl_host_state_delegate_)
43 return false;
45 return ssl_host_state_delegate_->HasAllowException(host);
48 void SSLPolicyBackend::AllowCertForHost(const net::X509Certificate& cert,
49 const std::string& host,
50 net::CertStatus error) {
51 if (ssl_host_state_delegate_)
52 ssl_host_state_delegate_->AllowCert(host, cert, error);
55 SSLHostStateDelegate::CertJudgment SSLPolicyBackend::QueryPolicy(
56 const net::X509Certificate& cert,
57 const std::string& host,
58 net::CertStatus error,
59 bool* expired_previous_decision) {
60 return ssl_host_state_delegate_ ?
61 ssl_host_state_delegate_->QueryPolicy(
62 host, cert, error, expired_previous_decision) :
63 SSLHostStateDelegate::DENIED;
66 } // namespace content