Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / ssl / ssl_policy_backend.h
blob18ec58035622da05d614e49fb46a0f22bb07b801
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 #ifndef CONTENT_BROWSER_SSL_SSL_POLICY_BACKEND_H_
6 #define CONTENT_BROWSER_SSL_SSL_POLICY_BACKEND_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "net/cert/x509_certificate.h"
15 namespace content {
16 class NavigationControllerImpl;
17 class SSLHostState;
19 class SSLPolicyBackend {
20 public:
21 explicit SSLPolicyBackend(NavigationControllerImpl* controller);
23 // Records that a host has run insecure content.
24 void HostRanInsecureContent(const std::string& host, int pid);
26 // Returns whether the specified host ran insecure content.
27 bool DidHostRunInsecureContent(const std::string& host, int pid) const;
29 // Records that |cert| is permitted to be used for |host| in the future.
30 void DenyCertForHost(net::X509Certificate* cert, const std::string& host);
32 // Records that |cert| is not permitted to be used for |host| in the future.
33 void AllowCertForHost(net::X509Certificate* cert, const std::string& host);
35 // Queries whether |cert| is allowed or denied for |host|.
36 net::CertPolicy::Judgment QueryPolicy(
37 net::X509Certificate* cert, const std::string& host);
39 private:
40 // SSL state specific for each host.
41 SSLHostState* ssl_host_state_;
43 NavigationControllerImpl* controller_;
45 DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend);
48 } // namespace content
50 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_BACKEND_H_