Chromium Code Reviews| 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 #include "chrome/browser/ui/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 // that useful (and would potentially be confusing) to warn about | 168 // that useful (and would potentially be confusing) to warn about |
| 169 // subesources that had certificate errors too. | 169 // subesources that had certificate errors too. |
| 170 if (net::IsCertStatusError(security_info.cert_status) && | 170 if (net::IsCertStatusError(security_info.cert_status) && |
| 171 !net::IsCertStatusMinorError(security_info.cert_status)) { | 171 !net::IsCertStatusMinorError(security_info.cert_status)) { |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 CheckContentStatus(security_info.content_with_cert_errors_status, displayed, | 174 CheckContentStatus(security_info.content_with_cert_errors_status, displayed, |
| 175 ran); | 175 ran); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void GetSiteIdentityByMaliciousContentStatus( | |
| 179 security_state::SecurityStateModel::MaliciousContentStatus | |
| 180 malicious_content_status, | |
| 181 WebsiteSettings::SiteIdentityStatus* status, | |
| 182 base::string16* details) { | |
| 183 switch (malicious_content_status) { | |
| 184 case security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE: | |
| 185 NOTREACHED(); | |
| 186 break; | |
| 187 case security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_MALWARE: | |
| 188 *status = WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE; | |
| 189 *details = | |
| 190 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MALWARE_DETAILS); | |
| 191 break; | |
| 192 case security_state::SecurityStateModel:: | |
| 193 MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING: | |
| 194 *status = WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING; | |
| 195 *details = l10n_util::GetStringUTF16( | |
| 196 IDS_WEBSITE_SETTINGS_SOCIAL_ENGINEERING_DETAILS); | |
| 197 break; | |
| 198 case security_state::SecurityStateModel:: | |
| 199 MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE: | |
| 200 *status = WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE; | |
| 201 *details = l10n_util::GetStringUTF16( | |
| 202 IDS_WEBSITE_SETTINGS_UNWANTED_SOFTWARE_DETAILS); | |
| 203 break; | |
| 204 } | |
| 205 } | |
| 206 | |
| 178 // Returns true if any of the given statuses match |status|. | 207 // Returns true if any of the given statuses match |status|. |
| 179 bool CertificateTransparencyStatusMatchAny( | 208 bool CertificateTransparencyStatusMatchAny( |
| 180 const std::vector<net::ct::SCTVerifyStatus>& sct_verify_statuses, | 209 const std::vector<net::ct::SCTVerifyStatus>& sct_verify_statuses, |
| 181 net::ct::SCTVerifyStatus status) { | 210 net::ct::SCTVerifyStatus status) { |
| 182 for (const auto& verify_status : sct_verify_statuses) { | 211 for (const auto& verify_status : sct_verify_statuses) { |
| 183 if (verify_status == status) | 212 if (verify_status == status) |
| 184 return true; | 213 return true; |
| 185 } | 214 } |
| 186 return false; | 215 return false; |
| 187 } | 216 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE; | 476 site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE; |
| 448 site_identity_details_ = | 477 site_identity_details_ = |
| 449 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE); | 478 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE); |
| 450 site_connection_status_ = SITE_CONNECTION_STATUS_INTERNAL_PAGE; | 479 site_connection_status_ = SITE_CONNECTION_STATUS_INTERNAL_PAGE; |
| 451 return; | 480 return; |
| 452 } | 481 } |
| 453 | 482 |
| 454 // Identity section. | 483 // Identity section. |
| 455 certificate_ = security_info.certificate; | 484 certificate_ = security_info.certificate; |
| 456 | 485 |
| 457 // HTTPS with no or minor errors. | 486 if (security_info.malicious_content_status != |
| 458 if (certificate_ && | 487 security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE) { |
| 459 (!net::IsCertStatusError(security_info.cert_status) || | 488 // The site has been flagged by Safe Browsing as dangerous. |
| 460 net::IsCertStatusMinorError(security_info.cert_status))) { | 489 GetSiteIdentityByMaliciousContentStatus( |
| 461 // There are no major errors. Check for minor errors. | 490 security_info.malicious_content_status, &site_identity_status_, |
| 491 &site_identity_details_); | |
|
estark
2016/11/11 22:22:15
I don't 100% understand what's going on here with
lgarron
2016/11/11 22:39:01
Yeah, the identity/connection split is legacy code
| |
| 492 } else if (certificate_ && | |
| 493 (!net::IsCertStatusError(security_info.cert_status) || | |
| 494 net::IsCertStatusMinorError(security_info.cert_status))) { | |
| 495 // HTTPS with no or minor errors. | |
| 462 if (security_info.security_level == | 496 if (security_info.security_level == |
| 463 SecurityStateModel::SECURE_WITH_POLICY_INSTALLED_CERT) { | 497 SecurityStateModel::SECURE_WITH_POLICY_INSTALLED_CERT) { |
| 464 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; | 498 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; |
| 465 site_identity_details_ = l10n_util::GetStringFUTF16( | 499 site_identity_details_ = l10n_util::GetStringFUTF16( |
| 466 IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, UTF8ToUTF16(url.host())); | 500 IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, UTF8ToUTF16(url.host())); |
| 467 } else if (net::IsCertStatusMinorError(security_info.cert_status)) { | 501 } else if (net::IsCertStatusMinorError(security_info.cert_status)) { |
| 468 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; | 502 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; |
| 469 base::string16 issuer_name( | 503 base::string16 issuer_name( |
| 470 UTF8ToUTF16(certificate_->issuer().GetDisplayName())); | 504 UTF8ToUTF16(certificate_->issuer().GetDisplayName())); |
| 471 if (issuer_name.empty()) { | 505 if (issuer_name.empty()) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 838 info.connection_status = site_connection_status_; | 872 info.connection_status = site_connection_status_; |
| 839 info.connection_status_description = | 873 info.connection_status_description = |
| 840 UTF16ToUTF8(site_connection_details_); | 874 UTF16ToUTF8(site_connection_details_); |
| 841 info.identity_status = site_identity_status_; | 875 info.identity_status = site_identity_status_; |
| 842 info.identity_status_description = | 876 info.identity_status_description = |
| 843 UTF16ToUTF8(site_identity_details_); | 877 UTF16ToUTF8(site_identity_details_); |
| 844 info.certificate = certificate_; | 878 info.certificate = certificate_; |
| 845 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 879 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
| 846 ui_->SetIdentityInfo(info); | 880 ui_->SetIdentityInfo(info); |
| 847 } | 881 } |
| OLD | NEW |