| 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/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 "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 const int kInvalidResourceID = -1; | 23 const int kInvalidResourceID = -1; |
| 23 | 24 |
| 24 // 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 |
| 25 // button if the permission setting is managed by policy. | 26 // button if the permission setting is managed by policy. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 84 |
| 84 const PermissionsUIInfo kPermissionsUIInfo[] = { | 85 const PermissionsUIInfo kPermissionsUIInfo[] = { |
| 85 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES, | 86 {CONTENT_SETTINGS_TYPE_COOKIES, 0, IDR_BLOCKED_COOKIES, |
| 86 IDR_ACCESSED_COOKIES}, | 87 IDR_ACCESSED_COOKIES}, |
| 87 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES, | 88 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_WEBSITE_SETTINGS_TYPE_IMAGES, |
| 88 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES}, | 89 IDR_BLOCKED_IMAGES, IDR_ALLOWED_IMAGES}, |
| 89 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT, | 90 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_WEBSITE_SETTINGS_TYPE_JAVASCRIPT, |
| 90 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT}, | 91 IDR_BLOCKED_JAVASCRIPT, IDR_ALLOWED_JAVASCRIPT}, |
| 91 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS, | 92 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_WEBSITE_SETTINGS_TYPE_POPUPS, |
| 92 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS}, | 93 IDR_BLOCKED_POPUPS, IDR_ALLOWED_POPUPS}, |
| 93 #if defined(ENABLE_PLUGINS) | 94 #if BUILDFLAG(ENABLE_PLUGINS) |
| 94 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_FLASH, | 95 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_WEBSITE_SETTINGS_TYPE_FLASH, |
| 95 IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS}, | 96 IDR_BLOCKED_PLUGINS, IDR_ALLOWED_PLUGINS}, |
| 96 #endif | 97 #endif |
| 97 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION, | 98 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_WEBSITE_SETTINGS_TYPE_LOCATION, |
| 98 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION}, | 99 IDR_BLOCKED_LOCATION, IDR_ALLOWED_LOCATION}, |
| 99 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 100 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 100 IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION, | 101 IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS, IDR_BLOCKED_NOTIFICATION, |
| 101 IDR_ALLOWED_NOTIFICATION}, | 102 IDR_ALLOWED_NOTIFICATION}, |
| 102 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_WEBSITE_SETTINGS_TYPE_MIC, | 103 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_WEBSITE_SETTINGS_TYPE_MIC, |
| 103 IDR_BLOCKED_MIC, IDR_ALLOWED_MIC}, | 104 IDR_BLOCKED_MIC, IDR_ALLOWED_MIC}, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 base::string16 WebsiteSettingsUI::PermissionActionToUIString( | 240 base::string16 WebsiteSettingsUI::PermissionActionToUIString( |
| 240 Profile* profile, | 241 Profile* profile, |
| 241 ContentSettingsType type, | 242 ContentSettingsType type, |
| 242 ContentSetting setting, | 243 ContentSetting setting, |
| 243 ContentSetting default_setting, | 244 ContentSetting default_setting, |
| 244 content_settings::SettingSource source) { | 245 content_settings::SettingSource source) { |
| 245 ContentSetting effective_setting = setting; | 246 ContentSetting effective_setting = setting; |
| 246 if (effective_setting == CONTENT_SETTING_DEFAULT) | 247 if (effective_setting == CONTENT_SETTING_DEFAULT) |
| 247 effective_setting = default_setting; | 248 effective_setting = default_setting; |
| 248 | 249 |
| 249 #if defined(ENABLE_PLUGINS) | 250 #if BUILDFLAG(ENABLE_PLUGINS) |
| 250 HostContentSettingsMap* host_content_settings_map = | 251 HostContentSettingsMap* host_content_settings_map = |
| 251 HostContentSettingsMapFactory::GetForProfile(profile); | 252 HostContentSettingsMapFactory::GetForProfile(profile); |
| 252 effective_setting = PluginsFieldTrial::EffectiveContentSetting( | 253 effective_setting = PluginsFieldTrial::EffectiveContentSetting( |
| 253 host_content_settings_map, type, effective_setting); | 254 host_content_settings_map, type, effective_setting); |
| 254 | 255 |
| 255 // Display the UI string for ASK instead of DETECT for HTML5 by Default. | 256 // Display the UI string for ASK instead of DETECT for HTML5 by Default. |
| 256 // TODO(tommycli): Once HTML5 by Default is shipped and the feature flag | 257 // TODO(tommycli): Once HTML5 by Default is shipped and the feature flag |
| 257 // is removed, just migrate the actual content setting to ASK. | 258 // is removed, just migrate the actual content setting to ASK. |
| 258 if (PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) && | 259 if (PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) && |
| 259 effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) { | 260 effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 396 } |
| 396 return resource_id; | 397 return resource_id; |
| 397 } | 398 } |
| 398 | 399 |
| 399 // static | 400 // static |
| 400 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( | 401 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( |
| 401 WebsiteSettings::SiteConnectionStatus status) { | 402 WebsiteSettings::SiteConnectionStatus status) { |
| 402 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 403 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 403 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 404 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
| 404 } | 405 } |
| OLD | NEW |