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

Side by Side Diff: chrome/browser/ui/page_info/page_info_ui.cc

Issue 2754383004: Rename WebsiteSettings code to PageInfo. (Closed)
Patch Set: Upload missing comment fix for WebSettingsUI -> PageInfoUI. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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/page_info/website_settings_ui.h" 5 #include "chrome/browser/ui/page_info/page_info_ui.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/plugins/plugin_utils.h" 9 #include "chrome/browser/plugins/plugin_utils.h"
10 #include "chrome/browser/plugins/plugins_field_trial.h" 10 #include "chrome/browser/plugins/plugins_field_trial.h"
11 #include "chrome/common/chrome_features.h" 11 #include "chrome/common/chrome_features.h"
12 #include "chrome/grit/chromium_strings.h" 12 #include "chrome/grit/chromium_strings.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "chrome/grit/theme_resources.h" 14 #include "chrome/grit/theme_resources.h"
15 #include "components/strings/grit/components_strings.h" 15 #include "components/strings/grit/components_strings.h"
16 #include "ppapi/features/features.h" 16 #include "ppapi/features/features.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 20
21 namespace { 21 namespace {
22 22
23 const int kInvalidResourceID = -1; 23 const int kInvalidResourceID = -1;
24 24
25 // The resource IDs for the strings that are displayed on the permissions 25 // The resource IDs for the strings that are displayed on the permissions
26 // button if the permission setting is managed by policy. 26 // button if the permission setting is managed by policy.
27 const int kPermissionButtonTextIDPolicyManaged[] = { 27 const int kPermissionButtonTextIDPolicyManaged[] = {
28 kInvalidResourceID, 28 kInvalidResourceID,
29 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_POLICY, 29 IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_POLICY,
30 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_POLICY, 30 IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_POLICY,
31 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_POLICY, 31 IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_POLICY,
32 kInvalidResourceID, 32 kInvalidResourceID,
33 kInvalidResourceID}; 33 kInvalidResourceID};
34 static_assert(arraysize(kPermissionButtonTextIDPolicyManaged) == 34 static_assert(arraysize(kPermissionButtonTextIDPolicyManaged) ==
35 CONTENT_SETTING_NUM_SETTINGS, 35 CONTENT_SETTING_NUM_SETTINGS,
36 "kPermissionButtonTextIDPolicyManaged array size is incorrect"); 36 "kPermissionButtonTextIDPolicyManaged array size is incorrect");
37 37
38 // The resource IDs for the strings that are displayed on the permissions 38 // The resource IDs for the strings that are displayed on the permissions
39 // button if the permission setting is managed by an extension. 39 // button if the permission setting is managed by an extension.
40 const int kPermissionButtonTextIDExtensionManaged[] = { 40 const int kPermissionButtonTextIDExtensionManaged[] = {
41 kInvalidResourceID, 41 kInvalidResourceID,
42 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_EXTENSION, 42 IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_EXTENSION,
43 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_EXTENSION, 43 IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_EXTENSION,
44 kInvalidResourceID, 44 kInvalidResourceID,
45 kInvalidResourceID, 45 kInvalidResourceID,
46 kInvalidResourceID}; 46 kInvalidResourceID};
47 static_assert(arraysize(kPermissionButtonTextIDExtensionManaged) == 47 static_assert(arraysize(kPermissionButtonTextIDExtensionManaged) ==
48 CONTENT_SETTING_NUM_SETTINGS, 48 CONTENT_SETTING_NUM_SETTINGS,
49 "kPermissionButtonTextIDExtensionManaged array size is " 49 "kPermissionButtonTextIDExtensionManaged array size is "
50 "incorrect"); 50 "incorrect");
51 51
52 // The resource IDs for the strings that are displayed on the permissions 52 // The resource IDs for the strings that are displayed on the permissions
53 // button if the permission setting is managed by the user. 53 // button if the permission setting is managed by the user.
54 const int kPermissionButtonTextIDUserManaged[] = { 54 const int kPermissionButtonTextIDUserManaged[] = {
55 kInvalidResourceID, 55 kInvalidResourceID,
56 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_USER, 56 IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_USER,
57 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_USER, 57 IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_USER,
58 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_USER, 58 IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_USER,
59 kInvalidResourceID, 59 kInvalidResourceID,
60 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER}; 60 IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER};
61 static_assert(arraysize(kPermissionButtonTextIDUserManaged) == 61 static_assert(arraysize(kPermissionButtonTextIDUserManaged) ==
62 CONTENT_SETTING_NUM_SETTINGS, 62 CONTENT_SETTING_NUM_SETTINGS,
63 "kPermissionButtonTextIDUserManaged array size is incorrect"); 63 "kPermissionButtonTextIDUserManaged array size is incorrect");
64 64
65 // The resource IDs for the strings that are displayed on the permissions 65 // The resource IDs for the strings that are displayed on the permissions
66 // button if the permission setting is the global default setting. 66 // button if the permission setting is the global default setting.
67 const int kPermissionButtonTextIDDefaultSetting[] = { 67 const int kPermissionButtonTextIDDefaultSetting[] = {
68 kInvalidResourceID, 68 kInvalidResourceID,
69 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_DEFAULT, 69 IDS_PAGE_INFO_BUTTON_TEXT_ALLOWED_BY_DEFAULT,
70 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_DEFAULT, 70 IDS_PAGE_INFO_BUTTON_TEXT_BLOCKED_BY_DEFAULT,
71 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_DEFAULT, 71 IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_DEFAULT,
72 kInvalidResourceID, 72 kInvalidResourceID,
73 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT}; 73 IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT};
74 static_assert(arraysize(kPermissionButtonTextIDDefaultSetting) == 74 static_assert(arraysize(kPermissionButtonTextIDDefaultSetting) ==
75 CONTENT_SETTING_NUM_SETTINGS, 75 CONTENT_SETTING_NUM_SETTINGS,
76 "kPermissionButtonTextIDDefaultSetting array size is incorrect"); 76 "kPermissionButtonTextIDDefaultSetting array size is incorrect");
77 77
78 struct PermissionsUIInfo { 78 struct PermissionsUIInfo {
79 ContentSettingsType type; 79 ContentSettingsType type;
80 int string_id; 80 int string_id;
81 int blocked_icon_id; 81 int blocked_icon_id;
82 int allowed_icon_id; 82 int allowed_icon_id;
83 }; 83 };
84 84
85 const PermissionsUIInfo kPermissionsUIInfo[] = { 85 const PermissionsUIInfo kPermissionsUIInfo[] = {
86 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES, 86 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES,
87 IDR_ACCESSED_COOKIES}, 87 IDR_ACCESSED_COOKIES},
88 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES, 88 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_PAGE_INFO_TYPE_IMAGES,
89 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES}, 89 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES},
90 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT, 90 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_PAGE_INFO_TYPE_JAVASCRIPT,
91 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT}, 91 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT},
92 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS, 92 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_PAGE_INFO_TYPE_POPUPS,
93 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS}, 93 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS},
94 #if BUILDFLAG(ENABLE_PLUGINS) 94 #if BUILDFLAG(ENABLE_PLUGINS)
95 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_FLASH, 95 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_PAGE_INFO_TYPE_FLASH,
96 IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS}, 96 IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS},
97 #endif 97 #endif
98 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION, 98 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_PAGE_INFO_TYPE_LOCATION,
99 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION}, 99 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION},
100 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 100 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, IDS_PAGE_INFO_TYPE_NOTIFICATIONS,
101 IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION, 101 IDR_BLOCKED_NOTIFICATION, IDR_ALLOWED_NOTIFICATION},
102 IDR_ALLOWED_NOTIFICATION}, 102 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_PAGE_INFO_TYPE_MIC,
103 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_WEBSITE_SETTINGS_TYPE_MIC,
104 IDR_BLOCKED_MIC, IDR_ALLOWED_MIC}, 103 IDR_BLOCKED_MIC, IDR_ALLOWED_MIC},
105 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, IDS_WEBSITE_SETTINGS_TYPE_CAMERA, 104 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, IDS_PAGE_INFO_TYPE_CAMERA,
106 IDR_BLOCKED_CAMERA, IDR_ALLOWED_CAMERA}, 105 IDR_BLOCKED_CAMERA, IDR_ALLOWED_CAMERA},
107 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 106 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
108 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL, IDR_BLOCKED_DOWNLOADS, 107 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL, IDR_BLOCKED_DOWNLOADS,
109 IDR_ALLOWED_DOWNLOADS}, 108 IDR_ALLOWED_DOWNLOADS},
110 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX, 109 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_PAGE_INFO_TYPE_MIDI_SYSEX,
111 IDR_BLOCKED_MIDI_SYSEX, IDR_ALLOWED_MIDI_SYSEX}, 110 IDR_BLOCKED_MIDI_SYSEX, IDR_ALLOWED_MIDI_SYSEX},
112 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, 111 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, IDS_PAGE_INFO_TYPE_BACKGROUND_SYNC,
113 IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC, IDR_BLOCKED_BACKGROUND_SYNC, 112 IDR_BLOCKED_BACKGROUND_SYNC, IDR_ALLOWED_BACKGROUND_SYNC},
114 IDR_ALLOWED_BACKGROUND_SYNC},
115 // Autoplay is Android-only at the moment, and the Origin Info bubble in 113 // Autoplay is Android-only at the moment, and the Origin Info bubble in
116 // Android ignores these block/allow icon pairs, so we can specify 0 there. 114 // Android ignores these block/allow icon pairs, so we can specify 0 there.
117 {CONTENT_SETTINGS_TYPE_AUTOPLAY, IDS_WEBSITE_SETTINGS_TYPE_AUTOPLAY, 0, 0}, 115 {CONTENT_SETTINGS_TYPE_AUTOPLAY, IDS_PAGE_INFO_TYPE_AUTOPLAY, 0, 0},
118 }; 116 };
119 117
120 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> 118 std::unique_ptr<PageInfoUI::SecurityDescription> CreateSecurityDescription(
121 CreateSecurityDescription(int summary_id, int details_id) { 119 int summary_id,
122 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( 120 int details_id) {
123 new WebsiteSettingsUI::SecurityDescription()); 121 std::unique_ptr<PageInfoUI::SecurityDescription> security_description(
122 new PageInfoUI::SecurityDescription());
124 security_description->summary = l10n_util::GetStringUTF16(summary_id); 123 security_description->summary = l10n_util::GetStringUTF16(summary_id);
125 security_description->details = l10n_util::GetStringUTF16(details_id); 124 security_description->details = l10n_util::GetStringUTF16(details_id);
126 return security_description; 125 return security_description;
127 } 126 }
128 } // namespace 127 } // namespace
129 128
130 WebsiteSettingsUI::CookieInfo::CookieInfo() : allowed(-1), blocked(-1) {} 129 PageInfoUI::CookieInfo::CookieInfo() : allowed(-1), blocked(-1) {}
131 130
132 WebsiteSettingsUI::PermissionInfo::PermissionInfo() 131 PageInfoUI::PermissionInfo::PermissionInfo()
133 : type(CONTENT_SETTINGS_TYPE_DEFAULT), 132 : type(CONTENT_SETTINGS_TYPE_DEFAULT),
134 setting(CONTENT_SETTING_DEFAULT), 133 setting(CONTENT_SETTING_DEFAULT),
135 default_setting(CONTENT_SETTING_DEFAULT), 134 default_setting(CONTENT_SETTING_DEFAULT),
136 source(content_settings::SETTING_SOURCE_NONE), 135 source(content_settings::SETTING_SOURCE_NONE),
137 is_incognito(false) {} 136 is_incognito(false) {}
138 137
139 WebsiteSettingsUI::ChosenObjectInfo::ChosenObjectInfo( 138 PageInfoUI::ChosenObjectInfo::ChosenObjectInfo(
140 const WebsiteSettings::ChooserUIInfo& ui_info, 139 const PageInfo::ChooserUIInfo& ui_info,
141 std::unique_ptr<base::DictionaryValue> object) 140 std::unique_ptr<base::DictionaryValue> object)
142 : ui_info(ui_info), object(std::move(object)) {} 141 : ui_info(ui_info), object(std::move(object)) {}
143 142
144 WebsiteSettingsUI::ChosenObjectInfo::~ChosenObjectInfo() {} 143 PageInfoUI::ChosenObjectInfo::~ChosenObjectInfo() {}
145 144
146 WebsiteSettingsUI::IdentityInfo::IdentityInfo() 145 PageInfoUI::IdentityInfo::IdentityInfo()
147 : identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN), 146 : identity_status(PageInfo::SITE_IDENTITY_STATUS_UNKNOWN),
148 connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN), 147 connection_status(PageInfo::SITE_CONNECTION_STATUS_UNKNOWN),
149 show_ssl_decision_revoke_button(false) {} 148 show_ssl_decision_revoke_button(false) {}
150 149
151 WebsiteSettingsUI::IdentityInfo::~IdentityInfo() {} 150 PageInfoUI::IdentityInfo::~IdentityInfo() {}
152 151
153 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> 152 std::unique_ptr<PageInfoUI::SecurityDescription>
154 WebsiteSettingsUI::IdentityInfo::GetSecurityDescription() const { 153 PageInfoUI::IdentityInfo::GetSecurityDescription() const {
155 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description( 154 std::unique_ptr<PageInfoUI::SecurityDescription> security_description(
156 new WebsiteSettingsUI::SecurityDescription()); 155 new PageInfoUI::SecurityDescription());
157 156
158 switch (identity_status) { 157 switch (identity_status) {
159 case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE: 158 case PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
160 // Internal pages have their own UI implementations which should never 159 // Internal pages have their own UI implementations which should never
161 // call this function. 160 // call this function.
162 NOTREACHED(); 161 NOTREACHED();
163 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: 162 case PageInfo::SITE_IDENTITY_STATUS_CERT:
164 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: 163 case PageInfo::SITE_IDENTITY_STATUS_EV_CERT:
165 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: 164 case PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
166 case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: 165 case PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
167 switch (connection_status) { 166 switch (connection_status) {
168 case WebsiteSettings:: 167 case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
169 SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
170 return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY, 168 return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY,
171 IDS_PAGEINFO_NOT_SECURE_DETAILS); 169 IDS_PAGEINFO_NOT_SECURE_DETAILS);
172 case WebsiteSettings:: 170 case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
173 SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
174 return CreateSecurityDescription(IDS_PAGEINFO_MIXED_CONTENT_SUMMARY, 171 return CreateSecurityDescription(IDS_PAGEINFO_MIXED_CONTENT_SUMMARY,
175 IDS_PAGEINFO_MIXED_CONTENT_DETAILS); 172 IDS_PAGEINFO_MIXED_CONTENT_DETAILS);
176 default: 173 default:
177 return CreateSecurityDescription(IDS_PAGEINFO_SECURE_SUMMARY, 174 return CreateSecurityDescription(IDS_PAGEINFO_SECURE_SUMMARY,
178 IDS_PAGEINFO_SECURE_DETAILS); 175 IDS_PAGEINFO_SECURE_DETAILS);
179 } 176 }
180 case WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE: 177 case PageInfo::SITE_IDENTITY_STATUS_MALWARE:
181 return CreateSecurityDescription(IDS_PAGEINFO_MALWARE_SUMMARY, 178 return CreateSecurityDescription(IDS_PAGEINFO_MALWARE_SUMMARY,
182 IDS_PAGEINFO_MALWARE_DETAILS); 179 IDS_PAGEINFO_MALWARE_DETAILS);
183 case WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING: 180 case PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING:
184 return CreateSecurityDescription(IDS_PAGEINFO_SOCIAL_ENGINEERING_SUMMARY, 181 return CreateSecurityDescription(IDS_PAGEINFO_SOCIAL_ENGINEERING_SUMMARY,
185 IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS); 182 IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS);
186 case WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE: 183 case PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE:
187 return CreateSecurityDescription(IDS_PAGEINFO_UNWANTED_SOFTWARE_SUMMARY, 184 return CreateSecurityDescription(IDS_PAGEINFO_UNWANTED_SOFTWARE_SUMMARY,
188 IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS); 185 IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS);
189 case WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM: 186 case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
190 case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN: 187 case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN:
191 case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT: 188 case PageInfo::SITE_IDENTITY_STATUS_NO_CERT:
192 default: 189 default:
193 return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY, 190 return CreateSecurityDescription(IDS_PAGEINFO_NOT_SECURE_SUMMARY,
194 IDS_PAGEINFO_NOT_SECURE_DETAILS); 191 IDS_PAGEINFO_NOT_SECURE_DETAILS);
195 } 192 }
196 } 193 }
197 194
198 WebsiteSettingsUI::~WebsiteSettingsUI() {} 195 PageInfoUI::~PageInfoUI() {}
199 196
200 // static 197 // static
201 base::string16 WebsiteSettingsUI::PermissionTypeToUIString( 198 base::string16 PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) {
202 ContentSettingsType type) {
203 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { 199 for (const PermissionsUIInfo& info : kPermissionsUIInfo) {
204 if (info.type == type) 200 if (info.type == type)
205 return l10n_util::GetStringUTF16(info.string_id); 201 return l10n_util::GetStringUTF16(info.string_id);
206 } 202 }
207 NOTREACHED(); 203 NOTREACHED();
208 return base::string16(); 204 return base::string16();
209 } 205 }
210 206
211 // static 207 // static
212 base::string16 WebsiteSettingsUI::PermissionValueToUIString( 208 base::string16 PageInfoUI::PermissionValueToUIString(ContentSetting value) {
213 ContentSetting value) {
214 switch (value) { 209 switch (value) {
215 case CONTENT_SETTING_ALLOW: 210 case CONTENT_SETTING_ALLOW:
216 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW); 211 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ALLOW);
217 case CONTENT_SETTING_BLOCK: 212 case CONTENT_SETTING_BLOCK:
218 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK); 213 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_BLOCK);
219 case CONTENT_SETTING_ASK: 214 case CONTENT_SETTING_ASK:
220 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK); 215 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ASK);
221 default: 216 default:
222 NOTREACHED(); 217 NOTREACHED();
223 return base::string16(); 218 return base::string16();
224 } 219 }
225 } 220 }
226 221
227 // static 222 // static
228 base::string16 WebsiteSettingsUI::PermissionActionToUIString( 223 base::string16 PageInfoUI::PermissionActionToUIString(
229 Profile* profile, 224 Profile* profile,
230 ContentSettingsType type, 225 ContentSettingsType type,
231 ContentSetting setting, 226 ContentSetting setting,
232 ContentSetting default_setting, 227 ContentSetting default_setting,
233 content_settings::SettingSource source) { 228 content_settings::SettingSource source) {
234 ContentSetting effective_setting = setting; 229 ContentSetting effective_setting = setting;
235 if (effective_setting == CONTENT_SETTING_DEFAULT) 230 if (effective_setting == CONTENT_SETTING_DEFAULT)
236 effective_setting = default_setting; 231 effective_setting = default_setting;
237 232
238 #if BUILDFLAG(ENABLE_PLUGINS) 233 #if BUILDFLAG(ENABLE_PLUGINS)
(...skipping 30 matching lines...) Expand all
269 default: 264 default:
270 NOTREACHED(); 265 NOTREACHED();
271 return base::string16(); 266 return base::string16();
272 } 267 }
273 int button_text_id = button_text_ids[effective_setting]; 268 int button_text_id = button_text_ids[effective_setting];
274 DCHECK_NE(button_text_id, kInvalidResourceID); 269 DCHECK_NE(button_text_id, kInvalidResourceID);
275 return l10n_util::GetStringUTF16(button_text_id); 270 return l10n_util::GetStringUTF16(button_text_id);
276 } 271 }
277 272
278 // static 273 // static
279 int WebsiteSettingsUI::GetPermissionIconID(ContentSettingsType type, 274 int PageInfoUI::GetPermissionIconID(ContentSettingsType type,
280 ContentSetting setting) { 275 ContentSetting setting) {
281 bool use_blocked = (setting == CONTENT_SETTING_BLOCK); 276 bool use_blocked = (setting == CONTENT_SETTING_BLOCK);
282 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { 277 for (const PermissionsUIInfo& info : kPermissionsUIInfo) {
283 if (info.type == type) 278 if (info.type == type)
284 return use_blocked ? info.blocked_icon_id : info.allowed_icon_id; 279 return use_blocked ? info.blocked_icon_id : info.allowed_icon_id;
285 } 280 }
286 NOTREACHED(); 281 NOTREACHED();
287 return IDR_INFO; 282 return IDR_INFO;
288 } 283 }
289 284
290 // static 285 // static
291 const gfx::Image& WebsiteSettingsUI::GetPermissionIcon( 286 const gfx::Image& PageInfoUI::GetPermissionIcon(const PermissionInfo& info) {
292 const PermissionInfo& info) {
293 ContentSetting setting = info.setting; 287 ContentSetting setting = info.setting;
294 if (setting == CONTENT_SETTING_DEFAULT) 288 if (setting == CONTENT_SETTING_DEFAULT)
295 setting = info.default_setting; 289 setting = info.default_setting;
296 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 290 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
297 return rb.GetNativeImageNamed(GetPermissionIconID(info.type, setting)); 291 return rb.GetNativeImageNamed(GetPermissionIconID(info.type, setting));
298 } 292 }
299 293
300 // static 294 // static
301 base::string16 WebsiteSettingsUI::ChosenObjectToUIString( 295 base::string16 PageInfoUI::ChosenObjectToUIString(
302 const ChosenObjectInfo& object) { 296 const ChosenObjectInfo& object) {
303 base::string16 name; 297 base::string16 name;
304 object.object->GetString(object.ui_info.ui_name_key, &name); 298 object.object->GetString(object.ui_info.ui_name_key, &name);
305 return name; 299 return name;
306 } 300 }
307 301
308 // static 302 // static
309 const gfx::Image& WebsiteSettingsUI::GetChosenObjectIcon( 303 const gfx::Image& PageInfoUI::GetChosenObjectIcon(
310 const ChosenObjectInfo& object, 304 const ChosenObjectInfo& object,
311 bool deleted) { 305 bool deleted) {
312 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 306 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
313 return rb.GetNativeImageNamed(deleted ? object.ui_info.blocked_icon_id 307 return rb.GetNativeImageNamed(deleted ? object.ui_info.blocked_icon_id
314 : object.ui_info.allowed_icon_id); 308 : object.ui_info.allowed_icon_id);
315 } 309 }
316 310
317 // static 311 // static
318 int WebsiteSettingsUI::GetIdentityIconID( 312 int PageInfoUI::GetIdentityIconID(PageInfo::SiteIdentityStatus status) {
319 WebsiteSettings::SiteIdentityStatus status) {
320 int resource_id = IDR_PAGEINFO_INFO; 313 int resource_id = IDR_PAGEINFO_INFO;
321 switch (status) { 314 switch (status) {
322 case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN: 315 case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN:
323 case WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE: 316 case PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE:
324 break; 317 break;
325 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: 318 case PageInfo::SITE_IDENTITY_STATUS_CERT:
326 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: 319 case PageInfo::SITE_IDENTITY_STATUS_EV_CERT:
327 resource_id = IDR_PAGEINFO_GOOD; 320 resource_id = IDR_PAGEINFO_GOOD;
328 break; 321 break;
329 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: 322 case PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
330 resource_id = IDR_PAGEINFO_WARNING_MINOR; 323 resource_id = IDR_PAGEINFO_WARNING_MINOR;
331 break; 324 break;
332 case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT: 325 case PageInfo::SITE_IDENTITY_STATUS_NO_CERT:
333 resource_id = IDR_PAGEINFO_WARNING_MAJOR; 326 resource_id = IDR_PAGEINFO_WARNING_MAJOR;
334 break; 327 break;
335 case WebsiteSettings::SITE_IDENTITY_STATUS_ERROR: 328 case PageInfo::SITE_IDENTITY_STATUS_ERROR:
336 resource_id = IDR_PAGEINFO_BAD; 329 resource_id = IDR_PAGEINFO_BAD;
337 break; 330 break;
338 case WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: 331 case PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT:
339 resource_id = IDR_PAGEINFO_ENTERPRISE_MANAGED; 332 resource_id = IDR_PAGEINFO_ENTERPRISE_MANAGED;
340 break; 333 break;
341 case WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM: 334 case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
342 resource_id = IDR_PAGEINFO_WARNING_MINOR; 335 resource_id = IDR_PAGEINFO_WARNING_MINOR;
343 break; 336 break;
344 default: 337 default:
345 NOTREACHED(); 338 NOTREACHED();
346 break; 339 break;
347 } 340 }
348 return resource_id; 341 return resource_id;
349 } 342 }
350 343
351 // static 344 // static
352 const gfx::Image& WebsiteSettingsUI::GetIdentityIcon( 345 const gfx::Image& PageInfoUI::GetIdentityIcon(
353 WebsiteSettings::SiteIdentityStatus status) { 346 PageInfo::SiteIdentityStatus status) {
354 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 347 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
355 return rb.GetNativeImageNamed(GetIdentityIconID(status)); 348 return rb.GetNativeImageNamed(GetIdentityIconID(status));
356 } 349 }
357 350
358 // static 351 // static
359 int WebsiteSettingsUI::GetConnectionIconID( 352 int PageInfoUI::GetConnectionIconID(PageInfo::SiteConnectionStatus status) {
360 WebsiteSettings::SiteConnectionStatus status) {
361 int resource_id = IDR_PAGEINFO_INFO; 353 int resource_id = IDR_PAGEINFO_INFO;
362 switch (status) { 354 switch (status) {
363 case WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN: 355 case PageInfo::SITE_CONNECTION_STATUS_UNKNOWN:
364 case WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE: 356 case PageInfo::SITE_CONNECTION_STATUS_INTERNAL_PAGE:
365 break; 357 break;
366 case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED: 358 case PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED:
367 resource_id = IDR_PAGEINFO_GOOD; 359 resource_id = IDR_PAGEINFO_GOOD;
368 break; 360 break;
369 case WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE: 361 case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
370 resource_id = IDR_PAGEINFO_WARNING_MINOR; 362 resource_id = IDR_PAGEINFO_WARNING_MINOR;
371 break; 363 break;
372 case WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED: 364 case PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED:
373 resource_id = IDR_PAGEINFO_WARNING_MAJOR; 365 resource_id = IDR_PAGEINFO_WARNING_MAJOR;
374 break; 366 break;
375 case WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE: 367 case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
376 case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR: 368 case PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR:
377 resource_id = IDR_PAGEINFO_BAD; 369 resource_id = IDR_PAGEINFO_BAD;
378 break; 370 break;
379 } 371 }
380 return resource_id; 372 return resource_id;
381 } 373 }
382 374
383 // static 375 // static
384 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( 376 const gfx::Image& PageInfoUI::GetConnectionIcon(
385 WebsiteSettings::SiteConnectionStatus status) { 377 PageInfo::SiteConnectionStatus status) {
386 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 378 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
387 return rb.GetNativeImageNamed(GetConnectionIconID(status)); 379 return rb.GetNativeImageNamed(GetConnectionIconID(status));
388 } 380 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/page_info/page_info_ui.h ('k') | chrome/browser/ui/page_info/page_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698