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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "chrome/browser/content_settings/host_content_settings_map.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 26 #include "chrome/browser/content_settings/local_shared_objects_container.h" | 26 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 27 #include "chrome/browser/history/history_service_factory.h" | 27 #include "chrome/browser/history/history_service_factory.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/ssl/ssl_error_info.h" | 29 #include "chrome/browser/ssl/ssl_error_info.h" |
| 30 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h " | 30 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h " |
| 31 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 31 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 32 #include "chrome/common/content_settings_pattern.h" | 32 #include "chrome/common/content_settings_pattern.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/cert_store.h" | 34 #include "content/public/browser/cert_store.h" |
| 35 #include "content/public/browser/ssl_host_state_delegate.h" | |
| 35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 36 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 37 #include "content/public/common/ssl_status.h" | 38 #include "content/public/common/ssl_status.h" |
| 38 #include "content/public/common/url_constants.h" | 39 #include "content/public/common/url_constants.h" |
| 39 #include "grit/chromium_strings.h" | 40 #include "grit/chromium_strings.h" |
| 40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 41 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 42 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 42 #include "net/cert/cert_status_flags.h" | 43 #include "net/cert/cert_status_flags.h" |
| 43 #include "net/cert/x509_certificate.h" | 44 #include "net/cert/x509_certificate.h" |
| 44 #include "net/ssl/ssl_cipher_suite_names.h" | 45 #include "net/ssl/ssl_cipher_suite_names.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 site_connection_details_ += l10n_util::GetStringUTF16( | 526 site_connection_details_ += l10n_util::GetStringUTF16( |
| 526 IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE); | 527 IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE); |
| 527 } | 528 } |
| 528 if (no_renegotiation) { | 529 if (no_renegotiation) { |
| 529 site_connection_details_ += ASCIIToUTF16("\n\n"); | 530 site_connection_details_ += ASCIIToUTF16("\n\n"); |
| 530 site_connection_details_ += l10n_util::GetStringUTF16( | 531 site_connection_details_ += l10n_util::GetStringUTF16( |
| 531 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); | 532 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); |
| 532 } | 533 } |
| 533 } | 534 } |
| 534 | 535 |
| 536 // Check if a user decision has been made to allow or deny certificates with | |
| 537 // errors on this site. | |
| 538 content::SSLHostStateDelegate* delegate = profile->GetSSLHostStateDelegate(); | |
| 539 if (delegate) | |
|
Peter Kasting
2014/08/11 22:35:41
Is there ever not a delegate? If so, consider not
| |
| 540 have_bypassed_ssl_error_ = delegate->HasUserDecision(url.host()); | |
| 541 | |
| 535 // By default select the permissions tab that displays all the site | 542 // By default select the permissions tab that displays all the site |
| 536 // permissions. In case of a connection error or an issue with the | 543 // permissions. In case of a connection error or an issue with the |
| 537 // certificate presented by the website, select the connection tab to draw | 544 // certificate presented by the website, select the connection tab to draw |
| 538 // the user's attention to the issue. If the site does not provide a | 545 // the user's attention to the issue. If the site does not provide a |
| 539 // certificate because it was loaded over an unencrypted connection, don't | 546 // certificate because it was loaded over an unencrypted connection, don't |
| 540 // select the connection tab. | 547 // select the connection tab. |
| 541 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; | 548 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; |
| 542 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || | 549 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || |
| 543 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || | 550 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || |
| 544 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || | 551 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 info.connection_status = site_connection_status_; | 665 info.connection_status = site_connection_status_; |
| 659 info.connection_status_description = | 666 info.connection_status_description = |
| 660 UTF16ToUTF8(site_connection_details_); | 667 UTF16ToUTF8(site_connection_details_); |
| 661 info.identity_status = site_identity_status_; | 668 info.identity_status = site_identity_status_; |
| 662 info.identity_status_description = | 669 info.identity_status_description = |
| 663 UTF16ToUTF8(site_identity_details_); | 670 UTF16ToUTF8(site_identity_details_); |
| 664 info.cert_id = cert_id_; | 671 info.cert_id = cert_id_; |
| 665 info.signed_certificate_timestamp_ids.assign( | 672 info.signed_certificate_timestamp_ids.assign( |
| 666 signed_certificate_timestamp_ids_.begin(), | 673 signed_certificate_timestamp_ids_.begin(), |
| 667 signed_certificate_timestamp_ids_.end()); | 674 signed_certificate_timestamp_ids_.end()); |
| 675 info.have_bypassed_ssl_error = have_bypassed_ssl_error_; | |
| 668 ui_->SetIdentityInfo(info); | 676 ui_->SetIdentityInfo(info); |
| 669 } | 677 } |
| 670 | 678 |
| 671 void WebsiteSettings::PresentHistoryInfo(base::Time first_visit) { | 679 void WebsiteSettings::PresentHistoryInfo(base::Time first_visit) { |
| 672 if (first_visit == base::Time()) { | 680 if (first_visit == base::Time()) { |
| 673 ui_->SetFirstVisit(base::string16()); | 681 ui_->SetFirstVisit(base::string16()); |
| 674 return; | 682 return; |
| 675 } | 683 } |
| 676 | 684 |
| 677 bool visited_before_today = false; | 685 bool visited_before_today = false; |
| 678 base::Time today = base::Time::Now().LocalMidnight(); | 686 base::Time today = base::Time::Now().LocalMidnight(); |
| 679 base::Time first_visit_midnight = first_visit.LocalMidnight(); | 687 base::Time first_visit_midnight = first_visit.LocalMidnight(); |
| 680 visited_before_today = (first_visit_midnight < today); | 688 visited_before_today = (first_visit_midnight < today); |
| 681 | 689 |
| 682 base::string16 first_visit_text; | 690 base::string16 first_visit_text; |
| 683 if (visited_before_today) { | 691 if (visited_before_today) { |
| 684 first_visit_text = l10n_util::GetStringFUTF16( | 692 first_visit_text = l10n_util::GetStringFUTF16( |
| 685 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 693 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
| 686 base::TimeFormatShortDate(first_visit)); | 694 base::TimeFormatShortDate(first_visit)); |
| 687 } else { | 695 } else { |
| 688 first_visit_text = l10n_util::GetStringUTF16( | 696 first_visit_text = l10n_util::GetStringUTF16( |
| 689 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); | 697 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); |
| 690 } | 698 } |
| 691 ui_->SetFirstVisit(first_visit_text); | 699 ui_->SetFirstVisit(first_visit_text); |
| 692 } | 700 } |
| OLD | NEW |