OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_BROWSER_SSL_SSL_POLICY_H_ | 5 #ifndef CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 void OnRequestStarted(SSLRequestInfo* info); | 37 void OnRequestStarted(SSLRequestInfo* info); |
38 | 38 |
39 // Update the SSL information in |entry| to match the current state. | 39 // Update the SSL information in |entry| to match the current state. |
40 // |web_contents| is the WebContentsImpl associated with this entry. | 40 // |web_contents| is the WebContentsImpl associated with this entry. |
41 void UpdateEntry(NavigationEntryImpl* entry, | 41 void UpdateEntry(NavigationEntryImpl* entry, |
42 WebContentsImpl* web_contents); | 42 WebContentsImpl* web_contents); |
43 | 43 |
44 SSLPolicyBackend* backend() const { return backend_; } | 44 SSLPolicyBackend* backend() const { return backend_; } |
45 | 45 |
46 private: | 46 private: |
| 47 enum OnCertErrorInternalOptionsMask { |
| 48 OVERRIDABLE = 1 << 0, |
| 49 STRICT_ENFORCEMENT = 1 << 1, |
| 50 EXPIRED_PREVIOUS_DECISION = 1 << 2 |
| 51 }; |
| 52 |
47 // Callback that the user chose to accept or deny the certificate. | 53 // Callback that the user chose to accept or deny the certificate. |
48 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 54 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
49 bool allow); | 55 bool allow); |
50 | 56 |
51 // Helper method for derived classes handling certificate errors. | 57 // Helper method for derived classes handling certificate errors. |
52 // | 58 // |
53 // |overridable| indicates whether or not the user could (assuming perfect | 59 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. |
| 60 // OVERRIDABLE indicates whether or not the user could (assuming perfect |
54 // knowledge) successfully override the error and still get the security | 61 // knowledge) successfully override the error and still get the security |
55 // guarantees of TLS. |strict_enforcement| indicates whether or not the | 62 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the |
56 // site the user is trying to connect to has requested strict enforcement | 63 // user is trying to connect to has requested strict enforcement of |
57 // of certificate validation (e.g. with HTTP Strict-Transport-Security). | 64 // certificate validation (e.g. with HTTP Strict-Transport-Security). |
58 void OnCertErrorInternal(SSLCertErrorHandler* handler, | 65 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been |
59 bool overridable, | 66 // previously made but the decision has expired. |
60 bool strict_enforcement); | 67 void OnCertErrorInternal(SSLCertErrorHandler* handler, int options_mask); |
61 | 68 |
62 // If the security style of |entry| has not been initialized, then initialize | 69 // If the security style of |entry| has not been initialized, then initialize |
63 // it with the default style for its URL. | 70 // it with the default style for its URL. |
64 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); | 71 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); |
65 | 72 |
66 // Mark |origin| as having run insecure content in the process with ID |pid|. | 73 // Mark |origin| as having run insecure content in the process with ID |pid|. |
67 void OriginRanInsecureContent(const std::string& origin, int pid); | 74 void OriginRanInsecureContent(const std::string& origin, int pid); |
68 | 75 |
69 // The backend we use to enact our decisions. | 76 // The backend we use to enact our decisions. |
70 SSLPolicyBackend* backend_; | 77 SSLPolicyBackend* backend_; |
71 | 78 |
72 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 79 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
73 }; | 80 }; |
74 | 81 |
75 } // namespace content | 82 } // namespace content |
76 | 83 |
77 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 84 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
OLD | NEW |