Chromium Code Reviews| Index: chrome/browser/ui/website_settings/website_settings_ui.cc |
| diff --git a/chrome/browser/ui/website_settings/website_settings_ui.cc b/chrome/browser/ui/website_settings/website_settings_ui.cc |
| index e38ed48786d64510ba5d7f6e705643409d60d3dd..9c29dde6d2b1ab1a1f8129f4b181e124ea97bb99 100644 |
| --- a/chrome/browser/ui/website_settings/website_settings_ui.cc |
| +++ b/chrome/browser/ui/website_settings/website_settings_ui.cc |
| @@ -118,6 +118,17 @@ const PermissionsUIInfo kPermissionsUIInfo[] = { |
| IDR_ALLOWED_BACKGROUND_SYNC}, |
| }; |
| +std::unique_ptr<WebsiteSettingsUI::SecurityDescription> |
| +CreateSecurityDescription(int summary_id, |
| + WebsiteSettingsUI::SecuritySummaryStyle summary_style, |
| + int details_id) { |
| + std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( |
| + new WebsiteSettingsUI::SecurityDescription()); |
| + security_description->summary = l10n_util::GetStringUTF16(summary_id); |
| + security_description->summary_style = summary_style; |
|
felt
2016/06/30 05:39:24
I'm a little confused, where is the summary_style
lgarron
2016/07/08 17:47:08
In the OS-specific code (website_settings_bubble_c
|
| + security_description->details = l10n_util::GetStringUTF16(details_id); |
| + return security_description; |
| +} |
| } // namespace |
| WebsiteSettingsUI::CookieInfo::CookieInfo() |
| @@ -147,43 +158,69 @@ WebsiteSettingsUI::IdentityInfo::IdentityInfo() |
| WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {} |
| -base::string16 WebsiteSettingsUI::IdentityInfo::GetSecuritySummary() const { |
| +std::unique_ptr<WebsiteSettingsUI::SecurityDescription> |
| +WebsiteSettingsUI::IdentityInfo::GetSecurityDescription() const { |
| + std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( |
| + new WebsiteSettingsUI::SecurityDescription()); |
| + |
| switch (identity_status) { |
| case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: |
| case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: |
| case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: |
| switch (connection_status) { |
| case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT: |
| - return l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_SETTINGS_MIXED_PASSIVE_CONTENT); |
| + return CreateSecurityDescription( |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, STYLE_YELLOW, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_SCRIPT: |
| - return l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_SETTINGS_MIXED_ACTIVE_CONTENT); |
| + return CreateSecurityDescription( |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| default: |
| - return l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_SETTINGS_SECURE_TRANSPORT); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_SECURE_SUMMARY, |
| + STYLE_GREEN, |
| + IDS_WEBSITE_SETTINGS_SECURE_DETAILS); |
| } |
| case WebsiteSettings:: |
| SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR: |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| + STYLE_YELLOW, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| case WebsiteSettings:: |
| SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR: |
| - return l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_DEPRECATED_SIGNATURE_ALGORITHM); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
|
felt
2016/06/30 05:39:24
Since some of these now share strings and styles,
lgarron
2016/07/08 17:47:08
I was planning to collapse these once the strings
|
| + STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: |
| - return l10n_util::GetStringUTF16(IDS_CERT_POLICY_PROVIDED_CERT_HEADER); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| + STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN: |
| - return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_UNKNOWN_TRANSPORT); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| + STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| case WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR: |
| - return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_CT_ERROR); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_SECURE_SUMMARY, |
| + STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_SECURE_DETAILS); |
| case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE: |
| - return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_INTERNAL_PAGE); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_INTERNAL_PAGE, |
| + STYLE_DEFAULT, |
| + IDS_WEBSITE_SETTINGS_INTERNAL_PAGE); |
| case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT: |
| default: |
| - return l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT); |
| + return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| + STYLE_RED, |
| + IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| } |
| } |
| +base::string16 WebsiteSettingsUI::IdentityInfo::GetSecuritySummary() const { |
| + std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description = |
| + GetSecurityDescription(); |
| + return security_description->summary; |
| +} |
| + |
| WebsiteSettingsUI::~WebsiteSettingsUI() { |
| } |