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