| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/public/browser/certificate_request_result_type.h" |
| 12 #include "content/public/common/resource_type.h" | 13 #include "content/public/common/resource_type.h" |
| 13 #include "content/public/common/security_style.h" | 14 #include "content/public/common/security_style.h" |
| 14 #include "net/cert/cert_status_flags.h" | 15 #include "net/cert/cert_status_flags.h" |
| 15 | 16 |
| 16 class GURL; | 17 class GURL; |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 class NavigationEntryImpl; | 20 class NavigationEntryImpl; |
| 20 class SSLCertErrorHandler; | 21 class SSLCertErrorHandler; |
| 21 class SSLPolicyBackend; | 22 class SSLPolicyBackend; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 enum OnCertErrorInternalOptionsMask { | 61 enum OnCertErrorInternalOptionsMask { |
| 61 OVERRIDABLE = 1 << 0, | 62 OVERRIDABLE = 1 << 0, |
| 62 STRICT_ENFORCEMENT = 1 << 1, | 63 STRICT_ENFORCEMENT = 1 << 1, |
| 63 EXPIRED_PREVIOUS_DECISION = 1 << 2 | 64 EXPIRED_PREVIOUS_DECISION = 1 << 2 |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 // Callback that the user chose to accept or deny the certificate. | 67 // Callback that the user chose to accept or deny the certificate. |
| 67 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 68 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
| 68 bool allow); | 69 CertificateRequestResultType decision); |
| 69 | 70 |
| 70 // Helper method for derived classes handling certificate errors. | 71 // Helper method for derived classes handling certificate errors. |
| 71 // | 72 // |
| 72 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. | 73 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. |
| 73 // OVERRIDABLE indicates whether or not the user could (assuming perfect | 74 // OVERRIDABLE indicates whether or not the user could (assuming perfect |
| 74 // knowledge) successfully override the error and still get the security | 75 // knowledge) successfully override the error and still get the security |
| 75 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the | 76 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the |
| 76 // user is trying to connect to has requested strict enforcement of | 77 // user is trying to connect to has requested strict enforcement of |
| 77 // certificate validation (e.g. with HTTP Strict-Transport-Security). | 78 // certificate validation (e.g. with HTTP Strict-Transport-Security). |
| 78 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been | 79 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been |
| 79 // previously made but the decision has expired. | 80 // previously made but the decision has expired. |
| 80 void OnCertErrorInternal(SSLCertErrorHandler* handler, int options_mask); | 81 void OnCertErrorInternal(SSLCertErrorHandler* handler, int options_mask); |
| 81 | 82 |
| 82 // If the security style of |entry| has not been initialized, then initialize | 83 // If the security style of |entry| has not been initialized, then initialize |
| 83 // it with the default style for its URL. | 84 // it with the default style for its URL. |
| 84 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); | 85 void InitializeEntryIfNeeded(NavigationEntryImpl* entry); |
| 85 | 86 |
| 86 // Mark |origin| as having run insecure content in the process with ID |pid|. | 87 // Mark |origin| as having run insecure content in the process with ID |pid|. |
| 87 void OriginRanInsecureContent(const std::string& origin, int pid); | 88 void OriginRanInsecureContent(const std::string& origin, int pid); |
| 88 | 89 |
| 89 // The backend we use to enact our decisions. | 90 // The backend we use to enact our decisions. |
| 90 SSLPolicyBackend* backend_; | 91 SSLPolicyBackend* backend_; |
| 91 | 92 |
| 92 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 93 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace content | 96 } // namespace content |
| 96 | 97 |
| 97 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 98 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
| OLD | NEW |