| 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 #include "components/security_state/security_state_model.h" | 5 #include "components/security_state/core/security_state.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "components/security_state/security_state_model_client.h" | 12 #include "components/security_state/core/switches.h" |
| 13 #include "components/security_state/switches.h" | |
| 14 #include "net/ssl/ssl_cipher_suite_names.h" | 13 #include "net/ssl/ssl_cipher_suite_names.h" |
| 15 #include "net/ssl/ssl_connection_status_flags.h" | 14 #include "net/ssl/ssl_connection_status_flags.h" |
| 16 | 15 |
| 17 namespace security_state { | 16 namespace security_state { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 // Do not change or reorder this enum, and add new values at the end. It is used | 20 // Do not change or reorder this enum, and add new values at the end. It is used |
| 22 // in the MarkHttpAs histogram. | 21 // in the MarkHttpAs histogram. |
| 23 enum MarkHttpStatus { NEUTRAL, NON_SECURE, HTTP_SHOW_WARNING, LAST_STATUS }; | 22 enum MarkHttpStatus { NEUTRAL, NON_SECURE, HTTP_SHOW_WARNING, LAST_STATUS }; |
| 24 | 23 |
| 25 // If |switch_or_field_trial_group| corresponds to a valid | 24 // If |switch_or_field_trial_group| corresponds to a valid |
| 26 // MarkHttpAs group, sets |*level| and |*histogram_status| to the | 25 // MarkHttpAs group, sets |*level| and |*histogram_status| to the |
| 27 // appropriate values and returns true. Otherwise, returns false. | 26 // appropriate values and returns true. Otherwise, returns false. |
| 28 bool GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 27 bool GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
| 29 std::string switch_or_field_trial_group, | 28 std::string switch_or_field_trial_group, |
| 30 bool displayed_sensitive_input_on_http, | 29 bool displayed_sensitive_input_on_http, |
| 31 SecurityStateModel::SecurityLevel* level, | 30 SecurityLevel* level, |
| 32 MarkHttpStatus* histogram_status) { | 31 MarkHttpStatus* histogram_status) { |
| 33 if (switch_or_field_trial_group == switches::kMarkHttpAsNeutral) { | 32 if (switch_or_field_trial_group == switches::kMarkHttpAsNeutral) { |
| 34 *level = SecurityStateModel::NONE; | 33 *level = NONE; |
| 35 *histogram_status = NEUTRAL; | 34 *histogram_status = NEUTRAL; |
| 36 return true; | 35 return true; |
| 37 } | 36 } |
| 38 | 37 |
| 39 if (switch_or_field_trial_group == switches::kMarkHttpAsDangerous) { | 38 if (switch_or_field_trial_group == switches::kMarkHttpAsDangerous) { |
| 40 *level = SecurityStateModel::DANGEROUS; | 39 *level = DANGEROUS; |
| 41 *histogram_status = NON_SECURE; | 40 *histogram_status = NON_SECURE; |
| 42 return true; | 41 return true; |
| 43 } | 42 } |
| 44 | 43 |
| 45 if (switch_or_field_trial_group == | 44 if (switch_or_field_trial_group == |
| 46 switches::kMarkHttpWithPasswordsOrCcWithChip || | 45 switches::kMarkHttpWithPasswordsOrCcWithChip || |
| 47 switch_or_field_trial_group == | 46 switch_or_field_trial_group == |
| 48 switches::kMarkHttpWithPasswordsOrCcWithChipAndFormWarning) { | 47 switches::kMarkHttpWithPasswordsOrCcWithChipAndFormWarning) { |
| 49 if (displayed_sensitive_input_on_http) { | 48 if (displayed_sensitive_input_on_http) { |
| 50 *level = SecurityStateModel::HTTP_SHOW_WARNING; | 49 *level = security_state::HTTP_SHOW_WARNING; |
| 51 } else { | 50 } else { |
| 52 *level = SecurityStateModel::NONE; | 51 *level = NONE; |
| 53 } | 52 } |
| 54 *histogram_status = HTTP_SHOW_WARNING; | 53 *histogram_status = HTTP_SHOW_WARNING; |
| 55 return true; | 54 return true; |
| 56 } | 55 } |
| 57 | 56 |
| 58 return false; | 57 return false; |
| 59 } | 58 } |
| 60 | 59 |
| 61 SecurityStateModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial( | 60 SecurityLevel GetSecurityLevelForNonSecureFieldTrial( |
| 62 bool displayed_sensitive_input_on_http) { | 61 bool displayed_sensitive_input_on_http) { |
| 63 std::string choice = | 62 std::string choice = |
| 64 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 63 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 65 switches::kMarkHttpAs); | 64 switches::kMarkHttpAs); |
| 66 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); | 65 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); |
| 67 | 66 |
| 68 const char kEnumeration[] = "SSL.MarkHttpAsStatus"; | 67 const char kEnumeration[] = "SSL.MarkHttpAsStatus"; |
| 69 | 68 |
| 70 SecurityStateModel::SecurityLevel level = SecurityStateModel::NONE; | 69 SecurityLevel level = NONE; |
| 71 MarkHttpStatus status; | 70 MarkHttpStatus status; |
| 72 | 71 |
| 73 // If the command-line switch is set, then it takes precedence over | 72 // If the command-line switch is set, then it takes precedence over |
| 74 // the field trial group. | 73 // the field trial group. |
| 75 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 74 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
| 76 choice, displayed_sensitive_input_on_http, &level, &status)) { | 75 choice, displayed_sensitive_input_on_http, &level, &status)) { |
| 77 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 76 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
| 78 group, displayed_sensitive_input_on_http, &level, &status)) { | 77 group, displayed_sensitive_input_on_http, &level, &status)) { |
| 79 // If neither the command-line switch nor field trial group is set, then | 78 // If neither the command-line switch nor field trial group is set, then |
| 80 // nonsecure defaults to neutral. | 79 // nonsecure defaults to neutral. |
| 81 status = NEUTRAL; | 80 status = NEUTRAL; |
| 82 level = SecurityStateModel::NONE; | 81 level = NONE; |
| 83 } | 82 } |
| 84 } | 83 } |
| 85 | 84 |
| 86 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); | 85 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); |
| 87 return level; | 86 return level; |
| 88 } | 87 } |
| 89 | 88 |
| 90 SecurityStateModel::SHA1DeprecationStatus GetSHA1DeprecationStatus( | 89 SHA1DeprecationStatus GetSHA1DeprecationStatus( |
| 91 const SecurityStateModel::VisibleSecurityState& visible_security_state) { | 90 const VisibleSecurityState& visible_security_state) { |
| 92 if (!visible_security_state.certificate || | 91 if (!visible_security_state.certificate || |
| 93 !(visible_security_state.cert_status & | 92 !(visible_security_state.cert_status & |
| 94 net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)) | 93 net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)) |
| 95 return SecurityStateModel::NO_DEPRECATED_SHA1; | 94 return NO_DEPRECATED_SHA1; |
| 96 | 95 |
| 97 // The internal representation of the dates for UI treatment of SHA-1. | 96 // The internal representation of the dates for UI treatment of SHA-1. |
| 98 // See http://crbug.com/401365 for details. | 97 // See http://crbug.com/401365 for details. |
| 99 static const int64_t kJanuary2017 = INT64_C(13127702400000000); | 98 static const int64_t kJanuary2017 = INT64_C(13127702400000000); |
| 100 if (visible_security_state.certificate->valid_expiry() >= | 99 if (visible_security_state.certificate->valid_expiry() >= |
| 101 base::Time::FromInternalValue(kJanuary2017)) | 100 base::Time::FromInternalValue(kJanuary2017)) |
| 102 return SecurityStateModel::DEPRECATED_SHA1_MAJOR; | 101 return DEPRECATED_SHA1_MAJOR; |
| 103 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | 102 static const int64_t kJanuary2016 = INT64_C(13096080000000000); |
| 104 if (visible_security_state.certificate->valid_expiry() >= | 103 if (visible_security_state.certificate->valid_expiry() >= |
| 105 base::Time::FromInternalValue(kJanuary2016)) | 104 base::Time::FromInternalValue(kJanuary2016)) |
| 106 return SecurityStateModel::DEPRECATED_SHA1_MINOR; | 105 return DEPRECATED_SHA1_MINOR; |
| 107 | 106 |
| 108 return SecurityStateModel::NO_DEPRECATED_SHA1; | 107 return NO_DEPRECATED_SHA1; |
| 109 } | 108 } |
| 110 | 109 |
| 111 SecurityStateModel::ContentStatus GetContentStatus(bool displayed, bool ran) { | 110 ContentStatus GetContentStatus(bool displayed, bool ran) { |
| 112 if (ran && displayed) | 111 if (ran && displayed) |
| 113 return SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | 112 return CONTENT_STATUS_DISPLAYED_AND_RAN; |
| 114 if (ran) | 113 if (ran) |
| 115 return SecurityStateModel::CONTENT_STATUS_RAN; | 114 return CONTENT_STATUS_RAN; |
| 116 if (displayed) | 115 if (displayed) |
| 117 return SecurityStateModel::CONTENT_STATUS_DISPLAYED; | 116 return CONTENT_STATUS_DISPLAYED; |
| 118 return SecurityStateModel::CONTENT_STATUS_NONE; | 117 return CONTENT_STATUS_NONE; |
| 119 } | 118 } |
| 120 | 119 |
| 121 SecurityStateModel::SecurityLevel GetSecurityLevelForRequest( | 120 SecurityLevel GetSecurityLevelForRequest( |
| 122 const SecurityStateModel::VisibleSecurityState& visible_security_state, | 121 const VisibleSecurityState& visible_security_state, |
| 123 SecurityStateModelClient* client, | 122 bool used_policy_installed_certificate, |
| 124 SecurityStateModel::SHA1DeprecationStatus sha1_status, | 123 const IsOriginSecureCallback& is_origin_secure_callback, |
| 125 SecurityStateModel::ContentStatus mixed_content_status, | 124 SHA1DeprecationStatus sha1_status, |
| 126 SecurityStateModel::ContentStatus content_with_cert_errors_status) { | 125 ContentStatus mixed_content_status, |
| 126 ContentStatus content_with_cert_errors_status) { |
| 127 DCHECK(visible_security_state.connection_info_initialized || | 127 DCHECK(visible_security_state.connection_info_initialized || |
| 128 visible_security_state.malicious_content_status != | 128 visible_security_state.malicious_content_status != |
| 129 SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE); | 129 MALICIOUS_CONTENT_STATUS_NONE); |
| 130 | 130 |
| 131 // Override the connection security information if the website failed the | 131 // Override the connection security information if the website failed the |
| 132 // browser's malware checks. | 132 // browser's malware checks. |
| 133 if (visible_security_state.malicious_content_status != | 133 if (visible_security_state.malicious_content_status != |
| 134 SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE) { | 134 MALICIOUS_CONTENT_STATUS_NONE) { |
| 135 return SecurityStateModel::DANGEROUS; | 135 return DANGEROUS; |
| 136 } | 136 } |
| 137 | 137 |
| 138 GURL url = visible_security_state.url; | 138 GURL url = visible_security_state.url; |
| 139 | 139 |
| 140 bool is_cryptographic_with_certificate = | 140 bool is_cryptographic_with_certificate = |
| 141 (url.SchemeIsCryptographic() && visible_security_state.certificate); | 141 (url.SchemeIsCryptographic() && visible_security_state.certificate); |
| 142 | 142 |
| 143 // Set the security level to DANGEROUS for major certificate errors. | 143 // Set the security level to DANGEROUS for major certificate errors. |
| 144 if (is_cryptographic_with_certificate && | 144 if (is_cryptographic_with_certificate && |
| 145 net::IsCertStatusError(visible_security_state.cert_status) && | 145 net::IsCertStatusError(visible_security_state.cert_status) && |
| 146 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { | 146 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { |
| 147 return SecurityStateModel::DANGEROUS; | 147 return DANGEROUS; |
| 148 } | 148 } |
| 149 | 149 |
| 150 // Choose the appropriate security level for HTTP requests. | 150 // Choose the appropriate security level for HTTP requests. |
| 151 if (!is_cryptographic_with_certificate) { | 151 if (!is_cryptographic_with_certificate) { |
| 152 if (!client->IsOriginSecure(url) && url.IsStandard()) { | 152 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) { |
| 153 return GetSecurityLevelForNonSecureFieldTrial( | 153 return GetSecurityLevelForNonSecureFieldTrial( |
| 154 visible_security_state.displayed_password_field_on_http || | 154 visible_security_state.displayed_password_field_on_http || |
| 155 visible_security_state.displayed_credit_card_field_on_http); | 155 visible_security_state.displayed_credit_card_field_on_http); |
| 156 } | 156 } |
| 157 return SecurityStateModel::NONE; | 157 return NONE; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Downgrade the security level for active insecure subresources. | 160 // Downgrade the security level for active insecure subresources. |
| 161 if (mixed_content_status == SecurityStateModel::CONTENT_STATUS_RAN || | 161 if (mixed_content_status == CONTENT_STATUS_RAN || |
| 162 mixed_content_status == | 162 mixed_content_status == CONTENT_STATUS_DISPLAYED_AND_RAN || |
| 163 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN || | 163 content_with_cert_errors_status == CONTENT_STATUS_RAN || |
| 164 content_with_cert_errors_status == | 164 content_with_cert_errors_status == CONTENT_STATUS_DISPLAYED_AND_RAN) { |
| 165 SecurityStateModel::CONTENT_STATUS_RAN || | 165 return kRanInsecureContentLevel; |
| 166 content_with_cert_errors_status == | |
| 167 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN) { | |
| 168 return SecurityStateModel::kRanInsecureContentLevel; | |
| 169 } | 166 } |
| 170 | 167 |
| 171 // Report if there is a policy cert first, before reporting any other | 168 // Report if there is a policy cert first, before reporting any other |
| 172 // authenticated-but-with-errors cases. A policy cert is a strong | 169 // authenticated-but-with-errors cases. A policy cert is a strong |
| 173 // indicator of a MITM being present (the enterprise), while the | 170 // indicator of a MITM being present (the enterprise), while the |
| 174 // other authenticated-but-with-errors indicate something may | 171 // other authenticated-but-with-errors indicate something may |
| 175 // be wrong, or may be wrong in the future, but is unclear now. | 172 // be wrong, or may be wrong in the future, but is unclear now. |
| 176 if (client->UsedPolicyInstalledCertificate()) | 173 if (used_policy_installed_certificate) |
| 177 return SecurityStateModel::SECURE_WITH_POLICY_INSTALLED_CERT; | 174 return SECURE_WITH_POLICY_INSTALLED_CERT; |
| 178 | 175 |
| 179 if (sha1_status == SecurityStateModel::DEPRECATED_SHA1_MAJOR) | 176 if (sha1_status == DEPRECATED_SHA1_MAJOR) |
| 180 return SecurityStateModel::DANGEROUS; | 177 return DANGEROUS; |
| 181 if (sha1_status == SecurityStateModel::DEPRECATED_SHA1_MINOR) | 178 if (sha1_status == DEPRECATED_SHA1_MINOR) |
| 182 return SecurityStateModel::NONE; | 179 return NONE; |
| 183 | 180 |
| 184 // Active mixed content is handled above. | 181 // Active mixed content is handled above. |
| 185 DCHECK_NE(SecurityStateModel::CONTENT_STATUS_RAN, mixed_content_status); | 182 DCHECK_NE(CONTENT_STATUS_RAN, mixed_content_status); |
| 186 DCHECK_NE(SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, | 183 DCHECK_NE(CONTENT_STATUS_DISPLAYED_AND_RAN, mixed_content_status); |
| 187 mixed_content_status); | |
| 188 | 184 |
| 189 if (mixed_content_status == SecurityStateModel::CONTENT_STATUS_DISPLAYED || | 185 if (mixed_content_status == CONTENT_STATUS_DISPLAYED || |
| 190 content_with_cert_errors_status == | 186 content_with_cert_errors_status == CONTENT_STATUS_DISPLAYED) { |
| 191 SecurityStateModel::CONTENT_STATUS_DISPLAYED) { | 187 return kDisplayedInsecureContentLevel; |
| 192 return SecurityStateModel::kDisplayedInsecureContentLevel; | |
| 193 } | 188 } |
| 194 | 189 |
| 195 if (net::IsCertStatusError(visible_security_state.cert_status)) { | 190 if (net::IsCertStatusError(visible_security_state.cert_status)) { |
| 196 // Major cert errors are handled above. | 191 // Major cert errors are handled above. |
| 197 DCHECK(net::IsCertStatusMinorError(visible_security_state.cert_status)); | 192 DCHECK(net::IsCertStatusMinorError(visible_security_state.cert_status)); |
| 198 return SecurityStateModel::NONE; | 193 return NONE; |
| 199 } | 194 } |
| 200 | 195 |
| 201 if ((visible_security_state.cert_status & net::CERT_STATUS_IS_EV) && | 196 if ((visible_security_state.cert_status & net::CERT_STATUS_IS_EV) && |
| 202 visible_security_state.certificate) { | 197 visible_security_state.certificate) { |
| 203 return SecurityStateModel::EV_SECURE; | 198 return EV_SECURE; |
| 204 } | 199 } |
| 205 return SecurityStateModel::SECURE; | 200 return SECURE; |
| 206 } | 201 } |
| 207 | 202 |
| 208 void SecurityInfoForRequest( | 203 void SecurityInfoForRequest( |
| 209 SecurityStateModelClient* client, | 204 const VisibleSecurityState& visible_security_state, |
| 210 const SecurityStateModel::VisibleSecurityState& visible_security_state, | 205 bool used_policy_installed_certificate, |
| 211 SecurityStateModel::SecurityInfo* security_info) { | 206 const IsOriginSecureCallback& is_origin_secure_callback, |
| 207 SecurityInfo* security_info) { |
| 212 if (!visible_security_state.connection_info_initialized) { | 208 if (!visible_security_state.connection_info_initialized) { |
| 213 *security_info = SecurityStateModel::SecurityInfo(); | 209 *security_info = SecurityInfo(); |
| 214 security_info->malicious_content_status = | 210 security_info->malicious_content_status = |
| 215 visible_security_state.malicious_content_status; | 211 visible_security_state.malicious_content_status; |
| 216 if (security_info->malicious_content_status != | 212 if (security_info->malicious_content_status != |
| 217 SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE) { | 213 MALICIOUS_CONTENT_STATUS_NONE) { |
| 218 security_info->security_level = GetSecurityLevelForRequest( | 214 security_info->security_level = GetSecurityLevelForRequest( |
| 219 visible_security_state, client, SecurityStateModel::UNKNOWN_SHA1, | 215 visible_security_state, used_policy_installed_certificate, |
| 220 SecurityStateModel::CONTENT_STATUS_UNKNOWN, | 216 is_origin_secure_callback, UNKNOWN_SHA1, CONTENT_STATUS_UNKNOWN, |
| 221 SecurityStateModel::CONTENT_STATUS_UNKNOWN); | 217 CONTENT_STATUS_UNKNOWN); |
| 222 } | 218 } |
| 223 return; | 219 return; |
| 224 } | 220 } |
| 225 security_info->certificate = visible_security_state.certificate; | 221 security_info->certificate = visible_security_state.certificate; |
| 226 security_info->sha1_deprecation_status = | 222 security_info->sha1_deprecation_status = |
| 227 GetSHA1DeprecationStatus(visible_security_state); | 223 GetSHA1DeprecationStatus(visible_security_state); |
| 228 security_info->mixed_content_status = | 224 security_info->mixed_content_status = |
| 229 GetContentStatus(visible_security_state.displayed_mixed_content, | 225 GetContentStatus(visible_security_state.displayed_mixed_content, |
| 230 visible_security_state.ran_mixed_content); | 226 visible_security_state.ran_mixed_content); |
| 231 security_info->content_with_cert_errors_status = GetContentStatus( | 227 security_info->content_with_cert_errors_status = GetContentStatus( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 245 | 241 |
| 246 security_info->malicious_content_status = | 242 security_info->malicious_content_status = |
| 247 visible_security_state.malicious_content_status; | 243 visible_security_state.malicious_content_status; |
| 248 | 244 |
| 249 security_info->displayed_password_field_on_http = | 245 security_info->displayed_password_field_on_http = |
| 250 visible_security_state.displayed_password_field_on_http; | 246 visible_security_state.displayed_password_field_on_http; |
| 251 security_info->displayed_credit_card_field_on_http = | 247 security_info->displayed_credit_card_field_on_http = |
| 252 visible_security_state.displayed_credit_card_field_on_http; | 248 visible_security_state.displayed_credit_card_field_on_http; |
| 253 | 249 |
| 254 security_info->security_level = GetSecurityLevelForRequest( | 250 security_info->security_level = GetSecurityLevelForRequest( |
| 255 visible_security_state, client, security_info->sha1_deprecation_status, | 251 visible_security_state, used_policy_installed_certificate, |
| 252 is_origin_secure_callback, security_info->sha1_deprecation_status, |
| 256 security_info->mixed_content_status, | 253 security_info->mixed_content_status, |
| 257 security_info->content_with_cert_errors_status); | 254 security_info->content_with_cert_errors_status); |
| 258 } | 255 } |
| 259 | 256 |
| 260 } // namespace | 257 } // namespace |
| 261 | 258 |
| 262 const SecurityStateModel::SecurityLevel | 259 SecurityInfo::SecurityInfo() |
| 263 SecurityStateModel::kDisplayedInsecureContentLevel = | 260 : security_level(NONE), |
| 264 SecurityStateModel::NONE; | 261 malicious_content_status(MALICIOUS_CONTENT_STATUS_NONE), |
| 265 const SecurityStateModel::SecurityLevel | 262 sha1_deprecation_status(NO_DEPRECATED_SHA1), |
| 266 SecurityStateModel::kRanInsecureContentLevel = | 263 mixed_content_status(CONTENT_STATUS_NONE), |
| 267 SecurityStateModel::DANGEROUS; | 264 content_with_cert_errors_status(CONTENT_STATUS_NONE), |
| 268 | |
| 269 SecurityStateModel::SecurityInfo::SecurityInfo() | |
| 270 : security_level(SecurityStateModel::NONE), | |
| 271 malicious_content_status( | |
| 272 SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE), | |
| 273 sha1_deprecation_status(SecurityStateModel::NO_DEPRECATED_SHA1), | |
| 274 mixed_content_status(SecurityStateModel::CONTENT_STATUS_NONE), | |
| 275 content_with_cert_errors_status(SecurityStateModel::CONTENT_STATUS_NONE), | |
| 276 scheme_is_cryptographic(false), | 265 scheme_is_cryptographic(false), |
| 277 cert_status(0), | 266 cert_status(0), |
| 278 security_bits(-1), | 267 security_bits(-1), |
| 279 connection_status(0), | 268 connection_status(0), |
| 280 key_exchange_group(0), | 269 key_exchange_group(0), |
| 281 obsolete_ssl_status(net::OBSOLETE_SSL_NONE), | 270 obsolete_ssl_status(net::OBSOLETE_SSL_NONE), |
| 282 pkp_bypassed(false), | 271 pkp_bypassed(false), |
| 283 displayed_password_field_on_http(false), | 272 displayed_password_field_on_http(false), |
| 284 displayed_credit_card_field_on_http(false) {} | 273 displayed_credit_card_field_on_http(false) {} |
| 285 | 274 |
| 286 SecurityStateModel::SecurityInfo::~SecurityInfo() {} | 275 SecurityInfo::~SecurityInfo() {} |
| 287 | 276 |
| 288 SecurityStateModel::SecurityStateModel() {} | 277 void GetSecurityInfo( |
| 289 | 278 std::unique_ptr<VisibleSecurityState> visible_security_state, |
| 290 SecurityStateModel::~SecurityStateModel() {} | 279 bool used_policy_installed_certificate, |
| 291 | 280 IsOriginSecureCallback is_origin_secure_callback, |
| 292 void SecurityStateModel::GetSecurityInfo( | 281 SecurityInfo* result) { |
| 293 SecurityStateModel::SecurityInfo* result) const { | 282 SecurityInfoForRequest(*visible_security_state, |
| 294 VisibleSecurityState new_visible_state; | 283 used_policy_installed_certificate, |
| 295 client_->GetVisibleSecurityState(&new_visible_state); | 284 is_origin_secure_callback, result); |
| 296 SecurityInfoForRequest(client_, new_visible_state, result); | |
| 297 } | 285 } |
| 298 | 286 |
| 299 void SecurityStateModel::SetClient(SecurityStateModelClient* client) { | 287 VisibleSecurityState::VisibleSecurityState() |
| 300 client_ = client; | 288 : malicious_content_status(MALICIOUS_CONTENT_STATUS_NONE), |
| 301 } | |
| 302 | |
| 303 SecurityStateModel::VisibleSecurityState::VisibleSecurityState() | |
| 304 : malicious_content_status( | |
| 305 SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE), | |
| 306 connection_info_initialized(false), | 289 connection_info_initialized(false), |
| 307 cert_status(0), | 290 cert_status(0), |
| 308 connection_status(0), | 291 connection_status(0), |
| 309 key_exchange_group(0), | 292 key_exchange_group(0), |
| 310 security_bits(-1), | 293 security_bits(-1), |
| 311 displayed_mixed_content(false), | 294 displayed_mixed_content(false), |
| 312 ran_mixed_content(false), | 295 ran_mixed_content(false), |
| 313 displayed_content_with_cert_errors(false), | 296 displayed_content_with_cert_errors(false), |
| 314 ran_content_with_cert_errors(false), | 297 ran_content_with_cert_errors(false), |
| 315 pkp_bypassed(false), | 298 pkp_bypassed(false), |
| 316 displayed_password_field_on_http(false), | 299 displayed_password_field_on_http(false), |
| 317 displayed_credit_card_field_on_http(false) {} | 300 displayed_credit_card_field_on_http(false) {} |
| 318 | 301 |
| 319 SecurityStateModel::VisibleSecurityState::~VisibleSecurityState() {} | 302 VisibleSecurityState::~VisibleSecurityState() {} |
| 320 | 303 |
| 321 bool SecurityStateModel::VisibleSecurityState::operator==( | 304 bool VisibleSecurityState::operator==(const VisibleSecurityState& other) const { |
| 322 const SecurityStateModel::VisibleSecurityState& other) const { | |
| 323 return (url == other.url && | 305 return (url == other.url && |
| 324 malicious_content_status == other.malicious_content_status && | 306 malicious_content_status == other.malicious_content_status && |
| 325 !!certificate == !!other.certificate && | 307 !!certificate == !!other.certificate && |
| 326 (certificate ? certificate->Equals(other.certificate.get()) : true) && | 308 (certificate ? certificate->Equals(other.certificate.get()) : true) && |
| 327 connection_status == other.connection_status && | 309 connection_status == other.connection_status && |
| 328 key_exchange_group == other.key_exchange_group && | 310 key_exchange_group == other.key_exchange_group && |
| 329 security_bits == other.security_bits && | 311 security_bits == other.security_bits && |
| 330 sct_verify_statuses == other.sct_verify_statuses && | 312 sct_verify_statuses == other.sct_verify_statuses && |
| 331 displayed_mixed_content == other.displayed_mixed_content && | 313 displayed_mixed_content == other.displayed_mixed_content && |
| 332 ran_mixed_content == other.ran_mixed_content && | 314 ran_mixed_content == other.ran_mixed_content && |
| 333 displayed_content_with_cert_errors == | 315 displayed_content_with_cert_errors == |
| 334 other.displayed_content_with_cert_errors && | 316 other.displayed_content_with_cert_errors && |
| 335 ran_content_with_cert_errors == other.ran_content_with_cert_errors && | 317 ran_content_with_cert_errors == other.ran_content_with_cert_errors && |
| 336 pkp_bypassed == other.pkp_bypassed && | 318 pkp_bypassed == other.pkp_bypassed && |
| 337 displayed_password_field_on_http == | 319 displayed_password_field_on_http == |
| 338 other.displayed_password_field_on_http && | 320 other.displayed_password_field_on_http && |
| 339 displayed_credit_card_field_on_http == | 321 displayed_credit_card_field_on_http == |
| 340 other.displayed_credit_card_field_on_http); | 322 other.displayed_credit_card_field_on_http); |
| 341 } | 323 } |
| 342 | 324 |
| 343 } // namespace security_state | 325 } // namespace security_state |
| OLD | NEW |