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 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 security_info.cert_id)); | 197 security_info.cert_id)); |
| 198 } else if (security_info.sha1_deprecation_status == | 198 } else if (security_info.sha1_deprecation_status == |
| 199 SecurityStateModel::DEPRECATED_SHA1_MINOR) { | 199 SecurityStateModel::DEPRECATED_SHA1_MINOR) { |
| 200 security_style_explanations->unauthenticated_explanations.push_back( | 200 security_style_explanations->unauthenticated_explanations.push_back( |
| 201 content::SecurityStyleExplanation( | 201 content::SecurityStyleExplanation( |
| 202 l10n_util::GetStringUTF8(IDS_MINOR_SHA1), | 202 l10n_util::GetStringUTF8(IDS_MINOR_SHA1), |
| 203 l10n_util::GetStringUTF8(IDS_MINOR_SHA1_DESCRIPTION), | 203 l10n_util::GetStringUTF8(IDS_MINOR_SHA1_DESCRIPTION), |
| 204 security_info.cert_id)); | 204 security_info.cert_id)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 security_style_explanations->ran_insecure_content = | 207 // Record the presence of mixed content (HTTP subresources on an HTTPS |
| 208 // page). | |
| 209 security_style_explanations->ran_mixed_content = | |
| 208 security_info.mixed_content_status == | 210 security_info.mixed_content_status == |
| 209 SecurityStateModel::CONTENT_STATUS_RAN || | 211 SecurityStateModel::CONTENT_STATUS_RAN || |
| 210 security_info.mixed_content_status == | 212 security_info.mixed_content_status == |
| 211 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | 213 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; |
| 212 security_style_explanations->displayed_insecure_content = | 214 security_style_explanations->displayed_mixed_content = |
| 213 security_info.mixed_content_status == | 215 security_info.mixed_content_status == |
| 214 SecurityStateModel::CONTENT_STATUS_DISPLAYED || | 216 SecurityStateModel::CONTENT_STATUS_DISPLAYED || |
| 215 security_info.mixed_content_status == | 217 security_info.mixed_content_status == |
| 216 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | 218 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; |
| 217 | 219 |
| 218 if (net::IsCertStatusError(security_info.cert_status)) { | 220 bool is_cert_status_error = net::IsCertStatusError(security_info.cert_status); |
| 221 bool is_cert_status_minor_error = | |
| 222 net::IsCertStatusMinorError(security_info.cert_status); | |
| 223 | |
| 224 // Record the presence of content with certificate errors (HTTPS | |
| 225 // subresources that were loaded with certificate errors, on an HTTPS | |
| 226 // page that was loaded without major certificate errors). | |
| 227 if (!is_cert_status_error || is_cert_status_minor_error) { | |
|
felt
2016/08/30 16:28:52
should that be an && instead of an ||?
estark
2016/08/30 16:36:57
Nope, I think || is right. |is_cert_status_error|
felt
2016/08/30 16:41:41
That's what I'm confused about -- you want this to
estark
2016/08/30 17:27:58
Ahhh, ok, I think I understand the confusion now.
| |
| 228 security_style_explanations->ran_content_with_cert_errors = | |
| 229 security_info.content_with_cert_errors_status == | |
| 230 SecurityStateModel::CONTENT_STATUS_RAN || | |
| 231 security_info.content_with_cert_errors_status == | |
| 232 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | |
| 233 security_style_explanations->displayed_content_with_cert_errors = | |
| 234 security_info.content_with_cert_errors_status == | |
| 235 SecurityStateModel::CONTENT_STATUS_DISPLAYED || | |
| 236 security_info.content_with_cert_errors_status == | |
| 237 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | |
| 238 } | |
| 239 | |
| 240 if (is_cert_status_error) { | |
| 219 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString( | 241 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString( |
| 220 net::MapCertStatusToNetError(security_info.cert_status))); | 242 net::MapCertStatusToNetError(security_info.cert_status))); |
| 221 | 243 |
| 222 content::SecurityStyleExplanation explanation( | 244 content::SecurityStyleExplanation explanation( |
| 223 l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), | 245 l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), |
| 224 l10n_util::GetStringFUTF8( | 246 l10n_util::GetStringFUTF8( |
| 225 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), | 247 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), |
| 226 security_info.cert_id); | 248 security_info.cert_id); |
| 227 | 249 |
| 228 if (net::IsCertStatusMinorError(security_info.cert_status)) | 250 if (is_cert_status_minor_error) { |
| 229 security_style_explanations->unauthenticated_explanations.push_back( | 251 security_style_explanations->unauthenticated_explanations.push_back( |
| 230 explanation); | 252 explanation); |
| 231 else | 253 } else { |
| 232 security_style_explanations->broken_explanations.push_back(explanation); | 254 security_style_explanations->broken_explanations.push_back(explanation); |
| 255 } | |
| 233 } else { | 256 } else { |
| 234 // If the certificate does not have errors and is not using | 257 // If the certificate does not have errors and is not using |
| 235 // deprecated SHA1, then add an explanation that the certificate is | 258 // deprecated SHA1, then add an explanation that the certificate is |
| 236 // valid. | 259 // valid. |
| 237 if (security_info.sha1_deprecation_status == | 260 if (security_info.sha1_deprecation_status == |
| 238 SecurityStateModel::NO_DEPRECATED_SHA1) { | 261 SecurityStateModel::NO_DEPRECATED_SHA1) { |
| 239 security_style_explanations->secure_explanations.push_back( | 262 security_style_explanations->secure_explanations.push_back( |
| 240 content::SecurityStyleExplanation( | 263 content::SecurityStyleExplanation( |
| 241 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), | 264 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), |
| 242 l10n_util::GetStringUTF8( | 265 l10n_util::GetStringUTF8( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 state->displayed_mixed_content = | 338 state->displayed_mixed_content = |
| 316 !!(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT); | 339 !!(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT); |
| 317 state->ran_mixed_content = | 340 state->ran_mixed_content = |
| 318 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT); | 341 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT); |
| 319 state->displayed_content_with_cert_errors = | 342 state->displayed_content_with_cert_errors = |
| 320 !!(ssl.content_status & | 343 !!(ssl.content_status & |
| 321 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS); | 344 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS); |
| 322 state->ran_content_with_cert_errors = | 345 state->ran_content_with_cert_errors = |
| 323 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); | 346 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); |
| 324 } | 347 } |
| OLD | NEW |