Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1875)

Unified Diff: chrome/browser/ui/website_settings/website_settings_ui.cc

Issue 2107123002: Convert OSX Page Info Bubble to Material Design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7b23ccfb0aa59af19bc99dd49ea43fb26d454d96 100644
--- a/chrome/browser/ui/website_settings/website_settings_ui.cc
+++ b/chrome/browser/ui/website_settings/website_settings_ui.cc
@@ -18,6 +18,14 @@ namespace {
const int kInvalidResourceID = -1;
+// Dummy value.
+const SkColor COLOR_UNSTYLED = SkColorSetRGB(0x00, 0x00, 0x00);
+
+// Chrome Material colors for text on light background.
+const SkColor COLOR_MATERIAL_GREEN = SkColorSetRGB(0x0B, 0x80, 0x43);
+const SkColor COLOR_MATERIAL_YELLOW = SkColorSetRGB(0xF1, 0x9D, 0x28);
+const SkColor COLOR_MATERIAL_RED = SkColorSetRGB(0xC5, 0x39, 0x29);
+
// The resource IDs for the strings that are displayed on the permissions
// button if the permission setting is managed by policy.
const int kPermissionButtonTextIDPolicyManaged[] = {
@@ -118,6 +126,19 @@ const PermissionsUIInfo kPermissionsUIInfo[] = {
IDR_ALLOWED_BACKGROUND_SYNC},
};
+std::unique_ptr<WebsiteSettingsUI::SecurityDescription>
+CreateSecurityDescription(int summary_id,
+ WebsiteSettingsUI::SecuritySummaryStyle summary_style,
+ SkColor summary_color,
+ 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;
+ security_description->summary_color = summary_color;
+ security_description->details = l10n_util::GetStringUTF16(details_id);
+ return security_description;
+}
} // namespace
WebsiteSettingsUI::CookieInfo::CookieInfo()
@@ -147,43 +168,54 @@ 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_INTERNAL_PAGE:
+ return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_INTERNAL_PAGE,
+ STYLE_UNSTYLED, COLOR_UNSTYLED,
+ IDS_WEBSITE_SETTINGS_INTERNAL_PAGE);
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
+ case WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR:
+ case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
switch (connection_status) {
- case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT:
- return l10n_util::GetStringUTF16(
- IDS_WEBSITE_SETTINGS_MIXED_PASSIVE_CONTENT);
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_COLOR,
+ COLOR_MATERIAL_RED, IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS);
+ case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT:
+ return CreateSecurityDescription(
+ IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, STYLE_COLOR,
+ COLOR_MATERIAL_YELLOW, IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS);
default:
- return l10n_util::GetStringUTF16(
- IDS_WEBSITE_SETTINGS_SECURE_TRANSPORT);
+ return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_SECURE_SUMMARY,
+ STYLE_COLOR, COLOR_MATERIAL_GREEN,
+ IDS_WEBSITE_SETTINGS_SECURE_DETAILS);
}
case WebsiteSettings::
SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR:
case WebsiteSettings::
SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR:
- return l10n_util::GetStringUTF16(
- IDS_WEBSITE_DEPRECATED_SIGNATURE_ALGORITHM);
- case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
- return l10n_util::GetStringUTF16(IDS_CERT_POLICY_PROVIDED_CERT_HEADER);
case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN:
- return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_UNKNOWN_TRANSPORT);
- case WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR:
- return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_CT_ERROR);
- case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
- return l10n_util::GetStringUTF16(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_COLOR, COLOR_MATERIAL_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() {
}

Powered by Google App Engine
This is Rietveld 408576698