Chromium Code Reviews| Index: chrome/browser/ui/website_settings/permission_menu_model.cc |
| diff --git a/chrome/browser/ui/website_settings/permission_menu_model.cc b/chrome/browser/ui/website_settings/permission_menu_model.cc |
| index aec4bb63562618170ecb7972e477b52551c6e8b7..2c6c8ec79c712b3d5a8a4ef9a2de5971705c253c 100644 |
| --- a/chrome/browser/ui/website_settings/permission_menu_model.cc |
| +++ b/chrome/browser/ui/website_settings/permission_menu_model.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/ui/website_settings/permission_menu_model.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "components/plugins/common/plugins_field_trial.h" |
| #include "ui/base/l10n/l10n_util.h" |
| PermissionMenuModel::PermissionMenuModel( |
| @@ -16,8 +17,15 @@ PermissionMenuModel::PermissionMenuModel( |
| base::string16 label; |
| switch (permission_.default_setting) { |
| case CONTENT_SETTING_ALLOW: |
| - label = l10n_util::GetStringUTF16( |
| - IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW); |
| + // For Plugins, allow flag to override displayed content setting. |
| + if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS && |
| + PluginsFieldTrial::EnableForcePluginPowerSaver()) { |
| + label = l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT); |
| + } else { |
| + label = l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW); |
| + } |
| break; |
| case CONTENT_SETTING_BLOCK: |
| label = l10n_util::GetStringUTF16( |
| @@ -90,12 +98,20 @@ PermissionMenuModel::PermissionMenuModel(const GURL& url, |
| PermissionMenuModel::~PermissionMenuModel() {} |
| bool PermissionMenuModel::IsCommandIdChecked(int command_id) const { |
| - // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. |
| - if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS && |
| - permission_.setting == CONTENT_SETTING_ASK && |
| - command_id == CONTENT_SETTING_BLOCK) { |
| - return true; |
| + if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
|
groby-ooo-7-16
2015/03/27 23:12:32
That logic is used several places. Worth factoring
tommycli
2015/03/28 00:40:04
Done. Seems better now. I was actually skeptical o
|
| + // For Plugins, allow flag to override displayed content setting. |
| + if (permission_.setting == CONTENT_SETTING_ALLOW && |
| + PluginsFieldTrial::EnableForcePluginPowerSaver()) { |
| + return command_id == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT; |
| + } |
| + |
| + // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. |
| + if (permission_.setting == CONTENT_SETTING_ASK && |
| + command_id == CONTENT_SETTING_BLOCK) { |
| + return true; |
| + } |
| } |
| + |
| return permission_.setting == command_id; |
| } |