| 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 "chrome/grit/chromium_strings.h" | 7 #include "chrome/grit/chromium_strings.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/plugins/common/plugins_field_trial.h" |
| 9 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 const int kInvalidResourceID = -1; | 17 const int kInvalidResourceID = -1; |
| 17 | 18 |
| 18 // The resource IDs for the strings that are displayed on the permissions | 19 // The resource IDs for the strings that are displayed on the permissions |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // static | 173 // static |
| 173 base::string16 WebsiteSettingsUI::PermissionActionToUIString( | 174 base::string16 WebsiteSettingsUI::PermissionActionToUIString( |
| 174 ContentSettingsType type, | 175 ContentSettingsType type, |
| 175 ContentSetting setting, | 176 ContentSetting setting, |
| 176 ContentSetting default_setting, | 177 ContentSetting default_setting, |
| 177 content_settings::SettingSource source) { | 178 content_settings::SettingSource source) { |
| 178 ContentSetting effective_setting = setting; | 179 ContentSetting effective_setting = setting; |
| 179 if (effective_setting == CONTENT_SETTING_DEFAULT) { | 180 if (effective_setting == CONTENT_SETTING_DEFAULT) { |
| 180 effective_setting = default_setting; | 181 effective_setting = default_setting; |
| 181 | 182 |
| 183 #if defined(ENABLE_PLUGINS) |
| 184 // For Plugins, allow flag to override displayed content setting. |
| 182 // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. | 185 // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. |
| 183 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && | 186 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 184 default_setting == CONTENT_SETTING_ASK) { | 187 if (default_setting == ContentSetting::CONTENT_SETTING_ALLOW && |
| 185 effective_setting = CONTENT_SETTING_BLOCK; | 188 PluginsFieldTrial::EnableForcePluginPowerSaver()) { |
| 189 effective_setting = |
| 190 ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT; |
| 191 } else if (default_setting == CONTENT_SETTING_ASK) { |
| 192 effective_setting = CONTENT_SETTING_BLOCK; |
| 193 } |
| 186 } | 194 } |
| 195 #endif // defined(ENABLE_PLUGINS) |
| 187 } | 196 } |
| 188 | 197 |
| 189 const int* button_text_ids = NULL; | 198 const int* button_text_ids = NULL; |
| 190 switch (source) { | 199 switch (source) { |
| 191 case content_settings::SETTING_SOURCE_USER: | 200 case content_settings::SETTING_SOURCE_USER: |
| 192 if (setting == CONTENT_SETTING_DEFAULT) | 201 if (setting == CONTENT_SETTING_DEFAULT) |
| 193 button_text_ids = kPermissionButtonTextIDDefaultSetting; | 202 button_text_ids = kPermissionButtonTextIDDefaultSetting; |
| 194 else | 203 else |
| 195 button_text_ids = kPermissionButtonTextIDUserManaged; | 204 button_text_ids = kPermissionButtonTextIDUserManaged; |
| 196 break; | 205 break; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // the first time. | 368 // the first time. |
| 360 return IDR_PAGEINFO_INFO; | 369 return IDR_PAGEINFO_INFO; |
| 361 } | 370 } |
| 362 | 371 |
| 363 // static | 372 // static |
| 364 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( | 373 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( |
| 365 const base::string16& first_visit) { | 374 const base::string16& first_visit) { |
| 366 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 375 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 367 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); | 376 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); |
| 368 } | 377 } |
| OLD | NEW |