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 #ifndef CONTENT_PUBLIC_BROWSER_SSL_SSL_HOST_STATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SSL_SSL_HOST_STATE_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/supports_user_data.h" |
| 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "content/common/content_export.h" |
| 17 #include "net/cert/cert_status_flags.h" |
| 18 #include "net/cert/x509_certificate.h" |
| 19 |
| 20 namespace content { |
| 21 class BrowserContext; |
| 22 |
| 23 // SSLHostState |
| 24 // |
| 25 // The SSLHostState encapulates the host-specific state for SSL errors. For |
| 26 // example, SSLHostState remembers whether the user has whitelisted a |
| 27 // particular broken cert for use with particular host. We separate this state |
| 28 // from the SSLManager because this state is shared across many navigation |
| 29 // controllers. |
| 30 |
| 31 class SSLHostState : NON_EXPORTED_BASE(base::SupportsUserData::Data), |
| 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 33 public: |
| 34 CONTENT_EXPORT static SSLHostState* GetFor(BrowserContext* browser_context); |
| 35 |
| 36 SSLHostState() {} |
| 37 virtual ~SSLHostState() {} |
| 38 |
| 39 // Records that a host has run insecure content. |
| 40 virtual void HostRanInsecureContent(const std::string& host, int pid) = 0; |
| 41 |
| 42 // Returns whether the specified host ran insecure content. |
| 43 virtual bool DidHostRunInsecureContent(const std::string& host, |
| 44 int pid) const = 0; |
| 45 |
| 46 // Records that |cert| is not permitted to be used for |host| in the future, |
| 47 // for a specified |error| type. |
| 48 virtual void DenyCertForHost(net::X509Certificate* cert, |
| 49 const std::string& host, |
| 50 net::CertStatus error) = 0; |
| 51 |
| 52 // Records that |cert| is permitted to be used for |host| in the future, for |
| 53 // a specified |error| type. |
| 54 virtual void AllowCertForHost(net::X509Certificate* cert, |
| 55 const std::string& host, |
| 56 net::CertStatus error) = 0; |
| 57 |
| 58 // Clear all allow/deny preferences. |
| 59 virtual void Clear() = 0; |
| 60 |
| 61 // Revoke all allow/deny preferences for a given host. May close idle |
| 62 // HTTP/HTTPS connections in the process. |
| 63 virtual void RevokeAllowAndDenyPreferences(const std::string& host) = 0; |
| 64 |
| 65 virtual bool HasAllowedOrDeniedCert(const std::string& host) = 0; |
| 66 |
| 67 // Queries whether |cert| is allowed or denied for |host| and |error|. |
| 68 virtual net::CertPolicy::Judgment QueryPolicy(net::X509Certificate* cert, |
| 69 const std::string& host, |
| 70 net::CertStatus error) = 0; |
| 71 |
| 72 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(SSLHostState); |
| 74 }; |
| 75 |
| 76 } // namespace content |
| 77 |
| 78 #endif // CONTENT_PUBLIC_BROWSER_SSL_SSL_HOST_STATE_H_ |
OLD | NEW |