| 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_ui.h" | 5 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 6 | 6 |
| 7 #include "grit/generated_resources.h" | 7 #include "grit/generated_resources.h" |
| 8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
| 9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 WebsiteSettingsUI::PermissionInfo::PermissionInfo() | 76 WebsiteSettingsUI::PermissionInfo::PermissionInfo() |
| 77 : type(CONTENT_SETTINGS_TYPE_DEFAULT), | 77 : type(CONTENT_SETTINGS_TYPE_DEFAULT), |
| 78 setting(CONTENT_SETTING_DEFAULT), | 78 setting(CONTENT_SETTING_DEFAULT), |
| 79 default_setting(CONTENT_SETTING_DEFAULT), | 79 default_setting(CONTENT_SETTING_DEFAULT), |
| 80 source(content_settings::SETTING_SOURCE_NONE) { | 80 source(content_settings::SETTING_SOURCE_NONE) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 WebsiteSettingsUI::IdentityInfo::IdentityInfo() | 83 WebsiteSettingsUI::IdentityInfo::IdentityInfo() |
| 84 : identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN), | 84 : identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN), |
| 85 cert_id(0), | 85 cert_id(0), |
| 86 connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN) { | 86 connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN), |
| 87 cert_transparency_status( |
| 88 WebsiteSettings::CERT_TRANSPARENCY_STATUS_UNKNOWN) { |
| 87 } | 89 } |
| 88 | 90 |
| 91 WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {} |
| 92 |
| 89 string16 WebsiteSettingsUI::IdentityInfo::GetIdentityStatusText() const { | 93 string16 WebsiteSettingsUI::IdentityInfo::GetIdentityStatusText() const { |
| 90 if (identity_status == WebsiteSettings::SITE_IDENTITY_STATUS_CERT || | 94 if (identity_status == WebsiteSettings::SITE_IDENTITY_STATUS_CERT || |
| 91 identity_status == WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT) { | 95 identity_status == WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT) { |
| 92 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_VERIFIED); | 96 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_VERIFIED); |
| 93 } | 97 } |
| 94 if (identity_status == | 98 if (identity_status == |
| 95 WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT) { | 99 WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT) { |
| 96 return l10n_util::GetStringUTF16(IDS_CERT_POLICY_PROVIDED_CERT_HEADER); | 100 return l10n_util::GetStringUTF16(IDS_CERT_POLICY_PROVIDED_CERT_HEADER); |
| 97 } | 101 } |
| 98 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_NOT_VERIFIED); | 102 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_NOT_VERIFIED); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 319 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
| 316 } | 320 } |
| 317 | 321 |
| 318 // static | 322 // static |
| 319 int WebsiteSettingsUI::GetFirstVisitIconID(const string16& first_visit) { | 323 int WebsiteSettingsUI::GetFirstVisitIconID(const string16& first_visit) { |
| 320 // FIXME(markusheintz): Display a minor warning icon if the page is visited | 324 // FIXME(markusheintz): Display a minor warning icon if the page is visited |
| 321 // the first time. | 325 // the first time. |
| 322 return IDR_PAGEINFO_INFO; | 326 return IDR_PAGEINFO_INFO; |
| 323 } | 327 } |
| 324 | 328 |
| 329 const gfx::Image& WebsiteSettingsUI::GetCertTransparencyIcon( |
| 330 WebsiteSettings::CertTransparencyStatus status) { |
| 331 int resource_id = IDR_PAGEINFO_INFO; |
| 332 switch (status) { |
| 333 case WebsiteSettings::CERT_TRANSPARENCY_STATUS_UNKNOWN: |
| 334 case WebsiteSettings::CERT_TRANSPARENCY_STATUS_HAS_SCT: |
| 335 break; |
| 336 case WebsiteSettings::CERT_TRANSPARENCY_STATUS_HAS_VALID_SCT: |
| 337 resource_id = IDR_PAGEINFO_GOOD; |
| 338 break; |
| 339 default: |
| 340 NOTREACHED(); |
| 341 break; |
| 342 } |
| 343 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 344 return rb.GetNativeImageNamed(resource_id); |
| 345 } |
| 346 |
| 325 // static | 347 // static |
| 326 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( | 348 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( |
| 327 const string16& first_visit) { | 349 const string16& first_visit) { |
| 328 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 350 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 329 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); | 351 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); |
| 330 } | 352 } |
| OLD | NEW |