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 | |
53 // Callback that the user chose to accept or deny the certificate. | 47 // Callback that the user chose to accept or deny the certificate. |
54 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 48 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
55 bool allow); | 49 bool allow); |
56 | 50 |
57 // Helper method for derived classes handling certificate errors. | 51 // Helper method for derived classes handling certificate errors. |
58 // | 52 // |
59 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. | 53 // |options_mask| should be a bitmask combination of |
60 // OVERRIDABLE indicates whether or not the user could (assuming perfect | 54 // ContentBrowserClient::AllowCertErrorOptionsMask. OVERRIDABLE indicates |
61 // knowledge) successfully override the error and still get the security | 55 // whether or not the user could (assuming perfect knowledge) successfully |
62 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the | 56 // override the error and still get the security guarantees of TLS. |
63 // user is trying to connect to has requested strict enforcement of | 57 // STRICT_ENFORCEMENT indicates whether or not the site the user is trying to |
64 // certificate validation (e.g. with HTTP Strict-Transport-Security). | 58 // connect to has requested strict enforcement of certificate validation (e.g. |
65 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been | 59 // with HTTP Strict-Transport-Security). EXPIRED_PREVIOUS_DECISION indicates |
66 // previously made but the decision has expired. | 60 // whether a user decision had been previously made but the decision has |
| 61 // expired. |
67 void OnCertErrorInternal(SSLCertErrorHandler* handler, int options_mask); | 62 void OnCertErrorInternal(SSLCertErrorHandler* handler, int options_mask); |
68 | 63 |
69 // If the security style of |entry| has not been initialized, then initialize | 64 // If the security style of |entry| has not been initialized, then initialize |
70 // it with the default style for its URL. | 65 // it with the default style for its URL. |
71 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); | 66 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); |
72 | 67 |
73 // Mark |origin| as having run insecure content in the process with ID |pid|. | 68 // Mark |origin| as having run insecure content in the process with ID |pid|. |
74 void OriginRanInsecureContent(const std::string& origin, int pid); | 69 void OriginRanInsecureContent(const std::string& origin, int pid); |
75 | 70 |
76 // The backend we use to enact our decisions. | 71 // The backend we use to enact our decisions. |
77 SSLPolicyBackend* backend_; | 72 SSLPolicyBackend* backend_; |
78 | 73 |
79 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 74 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
80 }; | 75 }; |
81 | 76 |
82 } // namespace content | 77 } // namespace content |
83 | 78 |
84 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 79 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
OLD | NEW |