| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 | 161 |
| 162 WebsiteSettings::WebsiteSettings( | 162 WebsiteSettings::WebsiteSettings( |
| 163 WebsiteSettingsUI* ui, | 163 WebsiteSettingsUI* ui, |
| 164 Profile* profile, | 164 Profile* profile, |
| 165 TabSpecificContentSettings* tab_specific_content_settings, | 165 TabSpecificContentSettings* tab_specific_content_settings, |
| 166 content::WebContents* web_contents, | 166 content::WebContents* web_contents, |
| 167 const GURL& url, | 167 const GURL& url, |
| 168 const SecurityStateModel::SecurityInfo& security_info, | 168 const security_state::SecurityStateModel::SecurityInfo& security_info, |
| 169 content::CertStore* cert_store) | 169 content::CertStore* cert_store) |
| 170 : TabSpecificContentSettings::SiteDataObserver( | 170 : TabSpecificContentSettings::SiteDataObserver( |
| 171 tab_specific_content_settings), | 171 tab_specific_content_settings), |
| 172 ui_(ui), | 172 ui_(ui), |
| 173 web_contents_(web_contents), | 173 web_contents_(web_contents), |
| 174 show_info_bar_(false), | 174 show_info_bar_(false), |
| 175 site_url_(url), | 175 site_url_(url), |
| 176 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), | 176 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
| 177 cert_id_(0), | 177 cert_id_(0), |
| 178 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), | 178 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() { | 306 void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() { |
| 307 DCHECK(chrome_ssl_host_state_delegate_); | 307 DCHECK(chrome_ssl_host_state_delegate_); |
| 308 chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( | 308 chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( |
| 309 site_url().host()); | 309 site_url().host()); |
| 310 did_revoke_user_ssl_decisions_ = true; | 310 did_revoke_user_ssl_decisions_ = true; |
| 311 } | 311 } |
| 312 | 312 |
| 313 void WebsiteSettings::Init( | 313 void WebsiteSettings::Init( |
| 314 const GURL& url, | 314 const GURL& url, |
| 315 const SecurityStateModel::SecurityInfo& security_info) { | 315 const security_state::SecurityStateModel::SecurityInfo& security_info) { |
| 316 bool isChromeUINativeScheme = false; | 316 bool isChromeUINativeScheme = false; |
| 317 #if BUILDFLAG(ANDROID_JAVA_UI) | 317 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 318 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); | 318 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); |
| 319 #endif | 319 #endif |
| 320 | 320 |
| 321 if (url.SchemeIs(url::kAboutScheme)) { | 321 if (url.SchemeIs(url::kAboutScheme)) { |
| 322 // All about: URLs except about:blank are redirected. | 322 // All about: URLs except about:blank are redirected. |
| 323 DCHECK_EQ(url::kAboutBlankURL, url.spec()); | 323 DCHECK_EQ(url::kAboutBlankURL, url.spec()); |
| 324 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; | 324 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
| 325 site_identity_details_ = | 325 site_identity_details_ = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 343 scoped_refptr<net::X509Certificate> cert; | 343 scoped_refptr<net::X509Certificate> cert; |
| 344 cert_id_ = security_info.cert_id; | 344 cert_id_ = security_info.cert_id; |
| 345 | 345 |
| 346 // HTTPS with no or minor errors. | 346 // HTTPS with no or minor errors. |
| 347 if (security_info.cert_id && | 347 if (security_info.cert_id && |
| 348 cert_store_->RetrieveCert(security_info.cert_id, &cert) && | 348 cert_store_->RetrieveCert(security_info.cert_id, &cert) && |
| 349 (!net::IsCertStatusError(security_info.cert_status) || | 349 (!net::IsCertStatusError(security_info.cert_status) || |
| 350 net::IsCertStatusMinorError(security_info.cert_status))) { | 350 net::IsCertStatusMinorError(security_info.cert_status))) { |
| 351 // There are no major errors. Check for minor errors. | 351 // There are no major errors. Check for minor errors. |
| 352 if (security_info.security_level == | 352 if (security_info.security_level == |
| 353 SecurityStateModel::SECURITY_POLICY_WARNING) { | 353 security_state::SecurityStateModel::SECURITY_POLICY_WARNING) { |
| 354 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; | 354 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; |
| 355 site_identity_details_ = l10n_util::GetStringFUTF16( | 355 site_identity_details_ = l10n_util::GetStringFUTF16( |
| 356 IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, UTF8ToUTF16(url.host())); | 356 IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, UTF8ToUTF16(url.host())); |
| 357 } else if (net::IsCertStatusMinorError(security_info.cert_status)) { | 357 } else if (net::IsCertStatusMinorError(security_info.cert_status)) { |
| 358 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; | 358 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; |
| 359 base::string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); | 359 base::string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); |
| 360 if (issuer_name.empty()) { | 360 if (issuer_name.empty()) { |
| 361 issuer_name.assign(l10n_util::GetStringUTF16( | 361 issuer_name.assign(l10n_util::GetStringUTF16( |
| 362 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 362 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 363 } | 363 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 issuer_name.assign(l10n_util::GetStringUTF16( | 419 issuer_name.assign(l10n_util::GetStringUTF16( |
| 420 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 420 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 421 } | 421 } |
| 422 | 422 |
| 423 site_identity_details_.assign(l10n_util::GetStringFUTF16( | 423 site_identity_details_.assign(l10n_util::GetStringFUTF16( |
| 424 GetSiteIdentityDetailsMessageByCTInfo( | 424 GetSiteIdentityDetailsMessageByCTInfo( |
| 425 security_info.sct_verify_statuses, false /* not EV */), | 425 security_info.sct_verify_statuses, false /* not EV */), |
| 426 issuer_name)); | 426 issuer_name)); |
| 427 } | 427 } |
| 428 switch (security_info.sha1_deprecation_status) { | 428 switch (security_info.sha1_deprecation_status) { |
| 429 case SecurityStateModel::DEPRECATED_SHA1_MINOR: | 429 case security_state::SecurityStateModel::DEPRECATED_SHA1_MINOR: |
| 430 site_identity_status_ = | 430 site_identity_status_ = |
| 431 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR; | 431 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR; |
| 432 site_identity_details_ += | 432 site_identity_details_ += |
| 433 UTF8ToUTF16("\n\n") + | 433 UTF8ToUTF16("\n\n") + |
| 434 l10n_util::GetStringUTF16( | 434 l10n_util::GetStringUTF16( |
| 435 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINO
R); | 435 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINO
R); |
| 436 break; | 436 break; |
| 437 case SecurityStateModel::DEPRECATED_SHA1_MAJOR: | 437 case security_state::SecurityStateModel::DEPRECATED_SHA1_MAJOR: |
| 438 site_identity_status_ = | 438 site_identity_status_ = |
| 439 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR; | 439 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR; |
| 440 site_identity_details_ += | 440 site_identity_details_ += |
| 441 UTF8ToUTF16("\n\n") + | 441 UTF8ToUTF16("\n\n") + |
| 442 l10n_util::GetStringUTF16( | 442 l10n_util::GetStringUTF16( |
| 443 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MAJO
R); | 443 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MAJO
R); |
| 444 break; | 444 break; |
| 445 case SecurityStateModel::NO_DEPRECATED_SHA1: | 445 case security_state::SecurityStateModel::NO_DEPRECATED_SHA1: |
| 446 // Nothing to do. | 446 // Nothing to do. |
| 447 break; | 447 break; |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 } else { | 450 } else { |
| 451 // HTTP or HTTPS with errors (not warnings). | 451 // HTTP or HTTPS with errors (not warnings). |
| 452 site_identity_details_.assign(l10n_util::GetStringUTF16( | 452 site_identity_details_.assign(l10n_util::GetStringUTF16( |
| 453 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); | 453 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
| 454 if (!security_info.scheme_is_cryptographic || !security_info.cert_id) | 454 if (!security_info.scheme_is_cryptographic || !security_info.cert_id) |
| 455 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; | 455 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // loaded over HTTP or loaded over HTTPS with no cert. | 489 // loaded over HTTP or loaded over HTTPS with no cert. |
| 490 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 490 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
| 491 | 491 |
| 492 site_connection_details_.assign(l10n_util::GetStringFUTF16( | 492 site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 493 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 493 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 494 subject_name)); | 494 subject_name)); |
| 495 } else if (security_info.security_bits < 0) { | 495 } else if (security_info.security_bits < 0) { |
| 496 // Security strength is unknown. Say nothing. | 496 // Security strength is unknown. Say nothing. |
| 497 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; | 497 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; |
| 498 } else if (security_info.security_bits == 0) { | 498 } else if (security_info.security_bits == 0) { |
| 499 DCHECK_NE(security_info.security_level, SecurityStateModel::NONE); | 499 DCHECK_NE(security_info.security_level, |
| 500 security_state::SecurityStateModel::NONE); |
| 500 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; | 501 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; |
| 501 site_connection_details_.assign(l10n_util::GetStringFUTF16( | 502 site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 502 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 503 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 503 subject_name)); | 504 subject_name)); |
| 504 } else { | 505 } else { |
| 505 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED; | 506 site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED; |
| 506 | 507 |
| 507 if (security_info.is_secure_protocol_and_ciphersuite) { | 508 if (security_info.is_secure_protocol_and_ciphersuite) { |
| 508 site_connection_details_.assign(l10n_util::GetStringFUTF16( | 509 site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 509 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, | 510 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, |
| 510 subject_name)); | 511 subject_name)); |
| 511 } else { | 512 } else { |
| 512 site_connection_details_.assign(l10n_util::GetStringFUTF16( | 513 site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 513 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, | 514 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, |
| 514 subject_name)); | 515 subject_name)); |
| 515 } | 516 } |
| 516 | 517 |
| 517 if (security_info.mixed_content_status != | 518 if (security_info.mixed_content_status != |
| 518 SecurityStateModel::NO_MIXED_CONTENT) { | 519 security_state::SecurityStateModel::NO_MIXED_CONTENT) { |
| 519 bool ran_insecure_content = | 520 bool ran_insecure_content = |
| 520 (security_info.mixed_content_status == | 521 (security_info.mixed_content_status == |
| 521 SecurityStateModel::RAN_MIXED_CONTENT || | 522 security_state::SecurityStateModel::RAN_MIXED_CONTENT || |
| 522 security_info.mixed_content_status == | 523 security_info.mixed_content_status == |
| 523 SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT); | 524 security_state::SecurityStateModel:: |
| 525 RAN_AND_DISPLAYED_MIXED_CONTENT); |
| 524 site_connection_status_ = ran_insecure_content | 526 site_connection_status_ = ran_insecure_content |
| 525 ? SITE_CONNECTION_STATUS_MIXED_SCRIPT | 527 ? SITE_CONNECTION_STATUS_MIXED_SCRIPT |
| 526 : SITE_CONNECTION_STATUS_MIXED_CONTENT; | 528 : SITE_CONNECTION_STATUS_MIXED_CONTENT; |
| 527 site_connection_details_.assign(l10n_util::GetStringFUTF16( | 529 site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 528 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, | 530 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, |
| 529 site_connection_details_, | 531 site_connection_details_, |
| 530 l10n_util::GetStringUTF16(ran_insecure_content ? | 532 l10n_util::GetStringUTF16(ran_insecure_content ? |
| 531 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : | 533 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : |
| 532 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); | 534 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); |
| 533 } | 535 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 info.connection_status = site_connection_status_; | 702 info.connection_status = site_connection_status_; |
| 701 info.connection_status_description = | 703 info.connection_status_description = |
| 702 UTF16ToUTF8(site_connection_details_); | 704 UTF16ToUTF8(site_connection_details_); |
| 703 info.identity_status = site_identity_status_; | 705 info.identity_status = site_identity_status_; |
| 704 info.identity_status_description = | 706 info.identity_status_description = |
| 705 UTF16ToUTF8(site_identity_details_); | 707 UTF16ToUTF8(site_identity_details_); |
| 706 info.cert_id = cert_id_; | 708 info.cert_id = cert_id_; |
| 707 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 709 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
| 708 ui_->SetIdentityInfo(info); | 710 ui_->SetIdentityInfo(info); |
| 709 } | 711 } |
| OLD | NEW |