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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); | 512 IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); |
517 } | 513 } |
518 } | 514 } |
519 | 515 |
520 // Site Connection | 516 // Site Connection |
521 // We consider anything less than 80 bits encryption to be weak encryption. | 517 // We consider anything less than 80 bits encryption to be weak encryption. |
522 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and | 518 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and |
523 // weakly encrypted connections. | 519 // weakly encrypted connections. |
524 site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN; | 520 site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN; |
525 | 521 |
526 base::string16 subject_name(GetSimpleSiteName(url, profile_)); | 522 base::string16 subject_name(GetSimpleSiteName(url)); |
527 if (subject_name.empty()) { | 523 if (subject_name.empty()) { |
528 subject_name.assign( | 524 subject_name.assign( |
529 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 525 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
530 } | 526 } |
531 | 527 |
532 if (!security_info.cert_id || !security_info.scheme_is_cryptographic) { | 528 if (!security_info.cert_id || !security_info.scheme_is_cryptographic) { |
533 // Page is still loading (so SSL status is not yet available) or | 529 // Page is still loading (so SSL status is not yet available) or |
534 // loaded over HTTP or loaded over HTTPS with no cert. | 530 // loaded over HTTP or loaded over HTTPS with no cert. |
535 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 531 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
536 | 532 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 748 |
753 void WebsiteSettings::PresentSiteIdentity() { | 749 void WebsiteSettings::PresentSiteIdentity() { |
754 // After initialization the status about the site's connection and its | 750 // After initialization the status about the site's connection and its |
755 // identity must be available. | 751 // identity must be available. |
756 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); | 752 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
757 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); | 753 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
758 WebsiteSettingsUI::IdentityInfo info; | 754 WebsiteSettingsUI::IdentityInfo info; |
759 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) | 755 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) |
760 info.site_identity = UTF16ToUTF8(organization_name()); | 756 info.site_identity = UTF16ToUTF8(organization_name()); |
761 else | 757 else |
762 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_, profile_)); | 758 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); |
763 | 759 |
764 info.connection_status = site_connection_status_; | 760 info.connection_status = site_connection_status_; |
765 info.connection_status_description = | 761 info.connection_status_description = |
766 UTF16ToUTF8(site_connection_details_); | 762 UTF16ToUTF8(site_connection_details_); |
767 info.identity_status = site_identity_status_; | 763 info.identity_status = site_identity_status_; |
768 info.identity_status_description = | 764 info.identity_status_description = |
769 UTF16ToUTF8(site_identity_details_); | 765 UTF16ToUTF8(site_identity_details_); |
770 info.cert_id = cert_id_; | 766 info.cert_id = cert_id_; |
771 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 767 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
772 ui_->SetIdentityInfo(info); | 768 ui_->SetIdentityInfo(info); |
773 } | 769 } |
OLD | NEW |