| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/plugins/plugins_field_trial.h" | 8 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 9 #include "chrome/grit/chromium_strings.h" | 9 #include "chrome/grit/chromium_strings.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 IDR_ALLOWED_DOWNLOADS}, | 109 IDR_ALLOWED_DOWNLOADS}, |
| 110 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX, | 110 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX, |
| 111 IDR_BLOCKED_MIDI_SYSEX, IDR_ALLOWED_MIDI_SYSEX}, | 111 IDR_BLOCKED_MIDI_SYSEX, IDR_ALLOWED_MIDI_SYSEX}, |
| 112 {CONTENT_SETTINGS_TYPE_KEYGEN, IDS_WEBSITE_SETTINGS_TYPE_KEYGEN, | 112 {CONTENT_SETTINGS_TYPE_KEYGEN, IDS_WEBSITE_SETTINGS_TYPE_KEYGEN, |
| 113 IDR_BLOCKED_KEYGEN, IDR_ALLOWED_KEYGEN}, | 113 IDR_BLOCKED_KEYGEN, IDR_ALLOWED_KEYGEN}, |
| 114 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, | 114 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, |
| 115 IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC, IDR_BLOCKED_BACKGROUND_SYNC, | 115 IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC, IDR_BLOCKED_BACKGROUND_SYNC, |
| 116 IDR_ALLOWED_BACKGROUND_SYNC}, | 116 IDR_ALLOWED_BACKGROUND_SYNC}, |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> |
| 120 CreateSecurityDescription(int summary_id, int details_id) { |
| 121 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( |
| 122 new WebsiteSettingsUI::SecurityDescription()); |
| 123 security_description->summary = l10n_util::GetStringUTF16(summary_id); |
| 124 security_description->details = l10n_util::GetStringUTF16(details_id); |
| 125 return security_description; |
| 126 } |
| 119 } // namespace | 127 } // namespace |
| 120 | 128 |
| 121 WebsiteSettingsUI::CookieInfo::CookieInfo() | 129 WebsiteSettingsUI::CookieInfo::CookieInfo() |
| 122 : allowed(-1), blocked(-1) { | 130 : allowed(-1), blocked(-1) { |
| 123 } | 131 } |
| 124 | 132 |
| 125 WebsiteSettingsUI::PermissionInfo::PermissionInfo() | 133 WebsiteSettingsUI::PermissionInfo::PermissionInfo() |
| 126 : type(CONTENT_SETTINGS_TYPE_DEFAULT), | 134 : type(CONTENT_SETTINGS_TYPE_DEFAULT), |
| 127 setting(CONTENT_SETTING_DEFAULT), | 135 setting(CONTENT_SETTING_DEFAULT), |
| 128 default_setting(CONTENT_SETTING_DEFAULT), | 136 default_setting(CONTENT_SETTING_DEFAULT), |
| 129 source(content_settings::SETTING_SOURCE_NONE), | 137 source(content_settings::SETTING_SOURCE_NONE), |
| 130 is_incognito(false) {} | 138 is_incognito(false) {} |
| 131 | 139 |
| 132 WebsiteSettingsUI::ChosenObjectInfo::ChosenObjectInfo( | 140 WebsiteSettingsUI::ChosenObjectInfo::ChosenObjectInfo( |
| 133 const WebsiteSettings::ChooserUIInfo& ui_info, | 141 const WebsiteSettings::ChooserUIInfo& ui_info, |
| 134 std::unique_ptr<base::DictionaryValue> object) | 142 std::unique_ptr<base::DictionaryValue> object) |
| 135 : ui_info(ui_info), object(std::move(object)) {} | 143 : ui_info(ui_info), object(std::move(object)) {} |
| 136 | 144 |
| 137 WebsiteSettingsUI::ChosenObjectInfo::~ChosenObjectInfo() {} | 145 WebsiteSettingsUI::ChosenObjectInfo::~ChosenObjectInfo() {} |
| 138 | 146 |
| 139 WebsiteSettingsUI::IdentityInfo::IdentityInfo() | 147 WebsiteSettingsUI::IdentityInfo::IdentityInfo() |
| 140 : identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN), | 148 : identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN), |
| 141 connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN), | 149 connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN), |
| 142 show_ssl_decision_revoke_button(false) { | 150 show_ssl_decision_revoke_button(false) { |
| 143 } | 151 } |
| 144 | 152 |
| 145 WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {} | 153 WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {} |
| 146 | 154 |
| 147 base::string16 WebsiteSettingsUI::IdentityInfo::GetSecuritySummary() const { | 155 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> |
| 156 WebsiteSettingsUI::IdentityInfo::GetSecurityDescription() const { |
| 157 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( |
| 158 new WebsiteSettingsUI::SecurityDescription()); |
| 159 |
| 148 switch (identity_status) { | 160 switch (identity_status) { |
| 161 case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE: |
| 162 return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_INTERNAL_PAGE, |
| 163 IDS_WEBSITE_SETTINGS_INTERNAL_PAGE); |
| 149 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: | 164 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: |
| 150 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: | 165 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: |
| 151 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: | 166 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: |
| 167 case WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR: |
| 168 case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: |
| 152 switch (connection_status) { | 169 switch (connection_status) { |
| 153 case WebsiteSettings:: | 170 case WebsiteSettings:: |
| 171 SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE: |
| 172 return CreateSecurityDescription( |
| 173 IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| 174 IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| 175 case WebsiteSettings:: |
| 154 SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE: | 176 SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE: |
| 155 return l10n_util::GetStringUTF16( | 177 return CreateSecurityDescription( |
| 156 IDS_WEBSITE_SETTINGS_INSECURE_PASSIVE_CONTENT); | 178 IDS_WEBSITE_SETTINGS_MIXED_CONTENT_SUMMARY, |
| 157 case WebsiteSettings:: | 179 IDS_WEBSITE_SETTINGS_MIXED_CONTENT_DETAILS); |
| 158 SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE: | |
| 159 return l10n_util::GetStringUTF16( | |
| 160 IDS_WEBSITE_SETTINGS_INSECURE_ACTIVE_CONTENT); | |
| 161 default: | 180 default: |
| 162 return l10n_util::GetStringUTF16( | 181 return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_SECURE_SUMMARY, |
| 163 IDS_WEBSITE_SETTINGS_SECURE_TRANSPORT); | 182 IDS_WEBSITE_SETTINGS_SECURE_DETAILS); |
| 164 } | 183 } |
| 165 case WebsiteSettings:: | 184 case WebsiteSettings:: |
| 166 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR: | 185 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR: |
| 167 case WebsiteSettings:: | 186 case WebsiteSettings:: |
| 168 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR: | 187 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR: |
| 169 return l10n_util::GetStringUTF16( | |
| 170 IDS_WEBSITE_DEPRECATED_SIGNATURE_ALGORITHM); | |
| 171 case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: | |
| 172 return l10n_util::GetStringUTF16(IDS_CERT_POLICY_PROVIDED_CERT_HEADER); | |
| 173 case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN: | 188 case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN: |
| 174 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_UNKNOWN_TRANSPORT); | |
| 175 case WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR: | |
| 176 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_CT_ERROR); | |
| 177 case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE: | |
| 178 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_INTERNAL_PAGE); | |
| 179 case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT: | 189 case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT: |
| 180 default: | 190 default: |
| 181 return l10n_util::GetStringUTF16( | 191 return CreateSecurityDescription(IDS_WEBSITE_SETTINGS_NOT_SECURE_SUMMARY, |
| 182 IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT); | 192 IDS_WEBSITE_SETTINGS_NOT_SECURE_DETAILS); |
| 183 } | 193 } |
| 184 } | 194 } |
| 185 | 195 |
| 196 base::string16 WebsiteSettingsUI::IdentityInfo::GetSecuritySummary() const { |
| 197 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description = |
| 198 GetSecurityDescription(); |
| 199 return security_description->summary; |
| 200 } |
| 201 |
| 186 WebsiteSettingsUI::~WebsiteSettingsUI() { | 202 WebsiteSettingsUI::~WebsiteSettingsUI() { |
| 187 } | 203 } |
| 188 | 204 |
| 189 // static | 205 // static |
| 190 base::string16 WebsiteSettingsUI::PermissionTypeToUIString( | 206 base::string16 WebsiteSettingsUI::PermissionTypeToUIString( |
| 191 ContentSettingsType type) { | 207 ContentSettingsType type) { |
| 192 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { | 208 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { |
| 193 if (info.type == type) | 209 if (info.type == type) |
| 194 return l10n_util::GetStringUTF16(info.string_id); | 210 return l10n_util::GetStringUTF16(info.string_id); |
| 195 } | 211 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 379 } |
| 364 return resource_id; | 380 return resource_id; |
| 365 } | 381 } |
| 366 | 382 |
| 367 // static | 383 // static |
| 368 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( | 384 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( |
| 369 WebsiteSettings::SiteConnectionStatus status) { | 385 WebsiteSettings::SiteConnectionStatus status) { |
| 370 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 386 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 371 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 387 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
| 372 } | 388 } |
| OLD | NEW |