Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SECURITY_STATE_SECURITY_STATE_H_ | 5 #ifndef COMPONENTS_SECURITY_STATE_CORE_SECURITY_STATE_H_ |
|
elawrence
2017/06/07 21:05:05
git cl lint insisted.
| |
| 6 #define COMPONENTS_SECURITY_STATE_SECURITY_STATE_H_ | 6 #define COMPONENTS_SECURITY_STATE_CORE_SECURITY_STATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/cert/cert_status_flags.h" | 14 #include "net/cert/cert_status_flags.h" |
| 15 #include "net/cert/sct_status_flags.h" | 15 #include "net/cert/sct_status_flags.h" |
| 16 #include "net/cert/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 bool pkp_bypassed; | 134 bool pkp_bypassed; |
| 135 // True if the page displayed password field on an HTTP page. | 135 // True if the page displayed password field on an HTTP page. |
| 136 bool displayed_password_field_on_http; | 136 bool displayed_password_field_on_http; |
| 137 // True if the page displayed credit card field on an HTTP page. | 137 // True if the page displayed credit card field on an HTTP page. |
| 138 bool displayed_credit_card_field_on_http; | 138 bool displayed_credit_card_field_on_http; |
| 139 // True if the secure page contained a form with a nonsecure target. | 139 // True if the secure page contained a form with a nonsecure target. |
| 140 bool contained_mixed_form; | 140 bool contained_mixed_form; |
| 141 // True if the server's certificate does not contain a | 141 // True if the server's certificate does not contain a |
| 142 // subjectAltName extension with a domain name or IP address. | 142 // subjectAltName extension with a domain name or IP address. |
| 143 bool cert_missing_subject_alt_name; | 143 bool cert_missing_subject_alt_name; |
| 144 // True if |IsHttpWarningForIncognitoEnabled| and the page was displayed in a | |
| 145 // non-secure Incognito context. | |
| 146 bool is_incognito; | |
| 144 }; | 147 }; |
| 145 | 148 |
| 146 // Contains the security state relevant to computing the SecurityInfo | 149 // Contains the security state relevant to computing the SecurityInfo |
| 147 // for a page. This is the input to GetSecurityInfo(). | 150 // for a page. This is the input to GetSecurityInfo(). |
| 148 struct VisibleSecurityState { | 151 struct VisibleSecurityState { |
| 149 VisibleSecurityState(); | 152 VisibleSecurityState(); |
| 150 ~VisibleSecurityState(); | 153 ~VisibleSecurityState(); |
| 151 bool operator==(const VisibleSecurityState& other) const; | 154 bool operator==(const VisibleSecurityState& other) const; |
| 152 GURL url; | 155 GURL url; |
| 153 | 156 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 174 // True if the page displayed passive subresources with certificate errors. | 177 // True if the page displayed passive subresources with certificate errors. |
| 175 bool displayed_content_with_cert_errors; | 178 bool displayed_content_with_cert_errors; |
| 176 // True if the page ran active subresources with certificate errors. | 179 // True if the page ran active subresources with certificate errors. |
| 177 bool ran_content_with_cert_errors; | 180 bool ran_content_with_cert_errors; |
| 178 // True if PKP was bypassed due to a local trust anchor. | 181 // True if PKP was bypassed due to a local trust anchor. |
| 179 bool pkp_bypassed; | 182 bool pkp_bypassed; |
| 180 // True if the page was an HTTP page that displayed a password field. | 183 // True if the page was an HTTP page that displayed a password field. |
| 181 bool displayed_password_field_on_http; | 184 bool displayed_password_field_on_http; |
| 182 // True if the page was an HTTP page that displayed a credit card field. | 185 // True if the page was an HTTP page that displayed a credit card field. |
| 183 bool displayed_credit_card_field_on_http; | 186 bool displayed_credit_card_field_on_http; |
| 187 // True if |IsHttpWarningForIncognitoEnabled| and the page was displayed in a | |
| 188 // non-secure Incognito context. | |
| 189 bool is_incognito; | |
| 184 }; | 190 }; |
| 185 | 191 |
| 186 // These security levels describe the treatment given to pages that | 192 // These security levels describe the treatment given to pages that |
| 187 // display and run mixed content. They are used to coordinate the | 193 // display and run mixed content. They are used to coordinate the |
| 188 // treatment of mixed content with other security UI elements. | 194 // treatment of mixed content with other security UI elements. |
| 189 constexpr SecurityLevel kDisplayedInsecureContentLevel = NONE; | 195 constexpr SecurityLevel kDisplayedInsecureContentLevel = NONE; |
| 190 constexpr SecurityLevel kRanInsecureContentLevel = DANGEROUS; | 196 constexpr SecurityLevel kRanInsecureContentLevel = DANGEROUS; |
| 191 | 197 |
| 192 // Returns true if the given |url|'s origin should be considered secure. | 198 // Returns true if the given |url|'s origin should be considered secure. |
| 193 using IsOriginSecureCallback = base::Callback<bool(const GURL& url)>; | 199 using IsOriginSecureCallback = base::Callback<bool(const GURL& url)>; |
| 194 | 200 |
| 195 // Populates |result| to describe the current page. | 201 // Populates |result| to describe the current page. |
| 196 // |visible_security_state| contains the relevant security state. | 202 // |visible_security_state| contains the relevant security state. |
| 197 // |used_policy_installed_certificate| indicates whether the page or request | 203 // |used_policy_installed_certificate| indicates whether the page or request |
| 198 // is known to be loaded with a certificate installed by the system admin. | 204 // is known to be loaded with a certificate installed by the system admin. |
| 199 // |is_origin_secure_callback| determines whether a URL's origin should be | 205 // |is_origin_secure_callback| determines whether a URL's origin should be |
| 200 // considered secure. | 206 // considered secure. |
| 201 void GetSecurityInfo( | 207 void GetSecurityInfo( |
| 202 std::unique_ptr<VisibleSecurityState> visible_security_state, | 208 std::unique_ptr<VisibleSecurityState> visible_security_state, |
| 203 bool used_policy_installed_certificate, | 209 bool used_policy_installed_certificate, |
| 204 IsOriginSecureCallback is_origin_secure_callback, | 210 IsOriginSecureCallback is_origin_secure_callback, |
| 205 SecurityInfo* result); | 211 SecurityInfo* result); |
| 206 | 212 |
| 207 // Returns true if an experimental form warning UI about HTTP passwords | 213 // Returns true if an experimental form warning UI about HTTP passwords |
| 208 // and credit cards is enabled. This warning UI can be enabled with the | 214 // and credit cards is enabled. This warning UI can be enabled with the |
| 209 // |kHttpFormWarningFeature| feature. | 215 // |kHttpFormWarningFeature| feature. |
| 210 bool IsHttpWarningInFormEnabled(); | 216 bool IsHttpWarningInFormEnabled(); |
| 211 | 217 |
| 218 // Returns true if the MarkHttpAs setting indicates that a warning | |
| 219 // should be shown for HTTP pages loaded while in Incognito mode. | |
| 220 bool IsHttpWarningForIncognitoEnabled(); | |
| 221 | |
| 212 } // namespace security_state | 222 } // namespace security_state |
| 213 | 223 |
| 214 #endif // COMPONENTS_SECURITY_STATE_SECURITY_STATE_H_ | 224 #endif // COMPONENTS_SECURITY_STATE_CORE_SECURITY_STATE_H_ |
| OLD | NEW |