OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 // strategy for certificate decisions or it may be left unimplemented to use a | 24 // strategy for certificate decisions or it may be left unimplemented to use a |
25 // default strategy of not remembering decisions at all. | 25 // default strategy of not remembering decisions at all. |
26 class SSLHostStateDelegate { | 26 class SSLHostStateDelegate { |
27 public: | 27 public: |
28 // The judgements that can be reached by a user for invalid certificates. | 28 // The judgements that can be reached by a user for invalid certificates. |
29 enum CertJudgment { | 29 enum CertJudgment { |
30 DENIED, | 30 DENIED, |
31 ALLOWED | 31 ALLOWED |
32 }; | 32 }; |
33 | 33 |
34 // The types of nonsecure subresources that this class keeps track of. | |
35 enum InsecureContentType { | |
36 // A MIXED subresource was loaded over HTTP on an HTTPS page. | |
37 MIXED_CONTENT, | |
38 // A CERT_ERRORS subresource was loaded over HTTPS with certificate | |
39 // errors on an HTTPS page. | |
40 CERT_ERRORS_CONTENT, | |
41 }; | |
42 | |
34 // Records that |cert| is permitted to be used for |host| in the future, for | 43 // Records that |cert| is permitted to be used for |host| in the future, for |
35 // a specified |error| type. | 44 // a specified |error| type. |
36 virtual void AllowCert(const std::string&, | 45 virtual void AllowCert(const std::string&, |
37 const net::X509Certificate& cert, | 46 const net::X509Certificate& cert, |
38 net::CertStatus error) = 0; | 47 net::CertStatus error) = 0; |
39 | 48 |
40 // Clear all allow preferences. | 49 // Clear all allow preferences. |
41 virtual void Clear() = 0; | 50 virtual void Clear() = 0; |
42 | 51 |
43 // Queries whether |cert| is allowed for |host| and |error|. Returns true in | 52 // Queries whether |cert| is allowed for |host| and |error|. Returns true in |
44 // |expired_previous_decision| if a previous user decision expired immediately | 53 // |expired_previous_decision| if a previous user decision expired immediately |
45 // prior to this query, otherwise false. | 54 // prior to this query, otherwise false. |
46 virtual CertJudgment QueryPolicy(const std::string& host, | 55 virtual CertJudgment QueryPolicy(const std::string& host, |
47 const net::X509Certificate& cert, | 56 const net::X509Certificate& cert, |
48 net::CertStatus error, | 57 net::CertStatus error, |
49 bool* expired_previous_decision) = 0; | 58 bool* expired_previous_decision) = 0; |
50 | 59 |
51 // Records that a host has run insecure content. | 60 // Records that a host has run insecure content of the given |content_type|. |
52 virtual void HostRanInsecureContent(const std::string& host, int pid) = 0; | 61 virtual void HostRanInsecureContent(const std::string& host, |
62 int pid, | |
jam
2016/08/11 19:53:13
nit: (in a followup if you agree), I just noticed
estark
2016/08/11 20:58:38
That sounds reasonable, I will file a bug to come
| |
63 InsecureContentType content_type) = 0; | |
53 | 64 |
54 // Returns whether the specified host ran insecure content. | 65 // Returns whether the specified host ran insecure content of the given |
55 virtual bool DidHostRunInsecureContent(const std::string& host, | 66 // |content_type|. |
56 int pid) const = 0; | 67 virtual bool DidHostRunInsecureContent( |
68 const std::string& host, | |
69 int pid, | |
70 InsecureContentType content_type) const = 0; | |
57 | 71 |
58 // Revokes all SSL certificate error allow exceptions made by the user for | 72 // Revokes all SSL certificate error allow exceptions made by the user for |
59 // |host|. | 73 // |host|. |
60 virtual void RevokeUserAllowExceptions(const std::string& host) = 0; | 74 virtual void RevokeUserAllowExceptions(const std::string& host) = 0; |
61 | 75 |
62 // Returns whether the user has allowed a certificate error exception for | 76 // Returns whether the user has allowed a certificate error exception for |
63 // |host|. This does not mean that *all* certificate errors are allowed, just | 77 // |host|. This does not mean that *all* certificate errors are allowed, just |
64 // that there exists an exception. To see if a particular certificate and | 78 // that there exists an exception. To see if a particular certificate and |
65 // error combination exception is allowed, use QueryPolicy(). | 79 // error combination exception is allowed, use QueryPolicy(). |
66 virtual bool HasAllowException(const std::string& host) const = 0; | 80 virtual bool HasAllowException(const std::string& host) const = 0; |
67 | 81 |
68 protected: | 82 protected: |
69 virtual ~SSLHostStateDelegate() {} | 83 virtual ~SSLHostStateDelegate() {} |
70 }; | 84 }; |
71 | 85 |
72 } // namespace content | 86 } // namespace content |
73 | 87 |
74 #endif // CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ | 88 #endif // CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_ |
OLD | NEW |