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/common/chrome_features.h" |
9 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
10 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
11 #include "chrome/grit/theme_resources.h" | 12 #include "chrome/grit/theme_resources.h" |
12 #include "components/strings/grit/components_strings.h" | 13 #include "components/strings/grit/components_strings.h" |
13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const PermissionsUIInfo kPermissionsUIInfo[] = { | 82 const PermissionsUIInfo kPermissionsUIInfo[] = { |
82 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES, | 83 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES, |
83 IDR_ACCESSED_COOKIES}, | 84 IDR_ACCESSED_COOKIES}, |
84 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES, | 85 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES, |
85 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES}, | 86 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES}, |
86 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT, | 87 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT, |
87 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT}, | 88 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT}, |
88 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS, | 89 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS, |
89 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS}, | 90 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS}, |
90 #if defined(ENABLE_PLUGINS) | 91 #if defined(ENABLE_PLUGINS) |
91 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_PLUGINS, | 92 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_FLASH, |
92 IDR_BLOCKED_POPUPS, IDR_ALLOWED_PLUGINS}, | 93 IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS}, |
93 #endif | 94 #endif |
94 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION, | 95 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION, |
95 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION}, | 96 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION}, |
96 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 97 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
97 IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION, | 98 IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION, |
98 IDR_ALLOWED_NOTIFICATION}, | 99 IDR_ALLOWED_NOTIFICATION}, |
99 {CONTENT_SETTINGS_TYPE_FULLSCREEN, IDS_WEBSITE_SETTINGS_TYPE_FULLSCREEN, | 100 {CONTENT_SETTINGS_TYPE_FULLSCREEN, IDS_WEBSITE_SETTINGS_TYPE_FULLSCREEN, |
100 IDR_ALLOWED_FULLSCREEN, IDR_ALLOWED_FULLSCREEN}, | 101 IDR_ALLOWED_FULLSCREEN, IDR_ALLOWED_FULLSCREEN}, |
101 {CONTENT_SETTINGS_TYPE_MOUSELOCK, IDS_WEBSITE_SETTINGS_TYPE_MOUSELOCK, | 102 {CONTENT_SETTINGS_TYPE_MOUSELOCK, IDS_WEBSITE_SETTINGS_TYPE_MOUSELOCK, |
102 IDR_BLOCKED_MOUSE_CURSOR, IDR_ALLOWED_MOUSE_CURSOR}, | 103 IDR_BLOCKED_MOUSE_CURSOR, IDR_ALLOWED_MOUSE_CURSOR}, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ContentSetting setting, | 230 ContentSetting setting, |
230 ContentSetting default_setting, | 231 ContentSetting default_setting, |
231 content_settings::SettingSource source) { | 232 content_settings::SettingSource source) { |
232 ContentSetting effective_setting = setting; | 233 ContentSetting effective_setting = setting; |
233 if (effective_setting == CONTENT_SETTING_DEFAULT) | 234 if (effective_setting == CONTENT_SETTING_DEFAULT) |
234 effective_setting = default_setting; | 235 effective_setting = default_setting; |
235 | 236 |
236 #if defined(ENABLE_PLUGINS) | 237 #if defined(ENABLE_PLUGINS) |
237 effective_setting = | 238 effective_setting = |
238 PluginsFieldTrial::EffectiveContentSetting(type, effective_setting); | 239 PluginsFieldTrial::EffectiveContentSetting(type, effective_setting); |
| 240 |
| 241 // Display the UI string for ASK instead of DETECT for HTML5 by Default. |
| 242 // TODO(tommycli): Once HTML5 by Default is shipped and the feature flag |
| 243 // is removed, just migrate the actual content setting to ASK. |
| 244 if (base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins) && |
| 245 effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) { |
| 246 effective_setting = CONTENT_SETTING_ASK; |
| 247 } |
239 #endif | 248 #endif |
240 | 249 |
241 const int* button_text_ids = NULL; | 250 const int* button_text_ids = NULL; |
242 switch (source) { | 251 switch (source) { |
243 case content_settings::SETTING_SOURCE_USER: | 252 case content_settings::SETTING_SOURCE_USER: |
244 if (setting == CONTENT_SETTING_DEFAULT) | 253 if (setting == CONTENT_SETTING_DEFAULT) |
245 button_text_ids = kPermissionButtonTextIDDefaultSetting; | 254 button_text_ids = kPermissionButtonTextIDDefaultSetting; |
246 else | 255 else |
247 button_text_ids = kPermissionButtonTextIDUserManaged; | 256 button_text_ids = kPermissionButtonTextIDUserManaged; |
248 break; | 257 break; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 382 } |
374 return resource_id; | 383 return resource_id; |
375 } | 384 } |
376 | 385 |
377 // static | 386 // static |
378 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( | 387 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( |
379 WebsiteSettings::SiteConnectionStatus status) { | 388 WebsiteSettings::SiteConnectionStatus status) { |
380 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 389 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
381 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 390 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
382 } | 391 } |
OLD | NEW |