| 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 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/permissions/permission_uma_util.h" | 34 #include "chrome/browser/permissions/permission_uma_util.h" |
| 35 #include "chrome/browser/permissions/permission_util.h" | 35 #include "chrome/browser/permissions/permission_util.h" |
| 36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 37 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 38 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 38 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
| 39 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 39 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 40 #include "chrome/browser/usb/usb_chooser_context.h" | 40 #include "chrome/browser/usb/usb_chooser_context.h" |
| 41 #include "chrome/browser/usb/usb_chooser_context_factory.h" | 41 #include "chrome/browser/usb/usb_chooser_context_factory.h" |
| 42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
| 43 #include "chrome/common/features.h" | 43 #include "chrome/common/features.h" |
| 44 #include "chrome/common/pref_names.h" | |
| 45 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 46 #include "chrome/grit/chromium_strings.h" | 45 #include "chrome/grit/chromium_strings.h" |
| 47 #include "chrome/grit/generated_resources.h" | 46 #include "chrome/grit/generated_resources.h" |
| 48 #include "chrome/grit/theme_resources.h" | 47 #include "chrome/grit/theme_resources.h" |
| 49 #include "components/content_settings/core/browser/content_settings_utils.h" | 48 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 50 #include "components/content_settings/core/browser/host_content_settings_map.h" | 49 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 51 #include "components/content_settings/core/browser/local_shared_objects_counter.
h" | 50 #include "components/content_settings/core/browser/local_shared_objects_counter.
h" |
| 52 #include "components/content_settings/core/common/content_settings.h" | 51 #include "components/content_settings/core/common/content_settings.h" |
| 53 #include "components/content_settings/core/common/content_settings_pattern.h" | 52 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 54 #include "components/rappor/rappor_utils.h" | 53 #include "components/rappor/rappor_utils.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 bool is_ev) { | 178 bool is_ev) { |
| 180 if (sct_verify_statuses.empty() || | 179 if (sct_verify_statuses.empty() || |
| 181 CertificateTransparencyStatusMatchAny(sct_verify_statuses, | 180 CertificateTransparencyStatusMatchAny(sct_verify_statuses, |
| 182 net::ct::SCT_STATUS_OK)) | 181 net::ct::SCT_STATUS_OK)) |
| 183 return is_ev ? WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT | 182 return is_ev ? WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT |
| 184 : WebsiteSettings::SITE_IDENTITY_STATUS_CERT; | 183 : WebsiteSettings::SITE_IDENTITY_STATUS_CERT; |
| 185 | 184 |
| 186 return WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR; | 185 return WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR; |
| 187 } | 186 } |
| 188 | 187 |
| 189 base::string16 GetSimpleSiteName(const GURL& url, Profile* profile) { | 188 base::string16 GetSimpleSiteName(const GURL& url) { |
| 190 std::string languages; | 189 return url_formatter::FormatUrlForSecurityDisplayOmitScheme(url); |
| 191 if (profile) | |
| 192 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
| 193 return url_formatter::FormatUrlForSecurityDisplayOmitScheme(url, languages); | |
| 194 } | 190 } |
| 195 | 191 |
| 196 ChooserContextBase* GetUsbChooserContext(Profile* profile) { | 192 ChooserContextBase* GetUsbChooserContext(Profile* profile) { |
| 197 return UsbChooserContextFactory::GetForProfile(profile); | 193 return UsbChooserContextFactory::GetForProfile(profile); |
| 198 } | 194 } |
| 199 | 195 |
| 200 // The list of chooser types that need to display entries in the Website | 196 // The list of chooser types that need to display entries in the Website |
| 201 // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, | 197 // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, |
| 202 // email security-dev@chromium.org. | 198 // email security-dev@chromium.org. |
| 203 WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = { | 199 WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); | 510 IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); |
| 515 } | 511 } |
| 516 } | 512 } |
| 517 | 513 |
| 518 // Site Connection | 514 // Site Connection |
| 519 // We consider anything less than 80 bits encryption to be weak encryption. | 515 // We consider anything less than 80 bits encryption to be weak encryption. |
| 520 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and | 516 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and |
| 521 // weakly encrypted connections. | 517 // weakly encrypted connections. |
| 522 site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN; | 518 site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN; |
| 523 | 519 |
| 524 base::string16 subject_name(GetSimpleSiteName(url, profile_)); | 520 base::string16 subject_name(GetSimpleSiteName(url)); |
| 525 if (subject_name.empty()) { | 521 if (subject_name.empty()) { |
| 526 subject_name.assign( | 522 subject_name.assign( |
| 527 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 523 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 528 } | 524 } |
| 529 | 525 |
| 530 if (!security_info.cert_id || !security_info.scheme_is_cryptographic) { | 526 if (!security_info.cert_id || !security_info.scheme_is_cryptographic) { |
| 531 // Page is still loading (so SSL status is not yet available) or | 527 // Page is still loading (so SSL status is not yet available) or |
| 532 // loaded over HTTP or loaded over HTTPS with no cert. | 528 // loaded over HTTP or loaded over HTTPS with no cert. |
| 533 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 529 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
| 534 | 530 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 746 |
| 751 void WebsiteSettings::PresentSiteIdentity() { | 747 void WebsiteSettings::PresentSiteIdentity() { |
| 752 // After initialization the status about the site's connection and its | 748 // After initialization the status about the site's connection and its |
| 753 // identity must be available. | 749 // identity must be available. |
| 754 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); | 750 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
| 755 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); | 751 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
| 756 WebsiteSettingsUI::IdentityInfo info; | 752 WebsiteSettingsUI::IdentityInfo info; |
| 757 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) | 753 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) |
| 758 info.site_identity = UTF16ToUTF8(organization_name()); | 754 info.site_identity = UTF16ToUTF8(organization_name()); |
| 759 else | 755 else |
| 760 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_, profile_)); | 756 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); |
| 761 | 757 |
| 762 info.connection_status = site_connection_status_; | 758 info.connection_status = site_connection_status_; |
| 763 info.connection_status_description = | 759 info.connection_status_description = |
| 764 UTF16ToUTF8(site_connection_details_); | 760 UTF16ToUTF8(site_connection_details_); |
| 765 info.identity_status = site_identity_status_; | 761 info.identity_status = site_identity_status_; |
| 766 info.identity_status_description = | 762 info.identity_status_description = |
| 767 UTF16ToUTF8(site_identity_details_); | 763 UTF16ToUTF8(site_identity_details_); |
| 768 info.cert_id = cert_id_; | 764 info.cert_id = cert_id_; |
| 769 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 765 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
| 770 ui_->SetIdentityInfo(info); | 766 ui_->SetIdentityInfo(info); |
| 771 } | 767 } |
| OLD | NEW |