| Index: components/content_settings/core/browser/plugins_field_trial.cc
|
| diff --git a/chrome/browser/plugins/plugins_field_trial.cc b/components/content_settings/core/browser/plugins_field_trial.cc
|
| similarity index 56%
|
| rename from chrome/browser/plugins/plugins_field_trial.cc
|
| rename to components/content_settings/core/browser/plugins_field_trial.cc
|
| index 5a526f00295a9a4784cd0c8f3d4783a0c28285f4..e02d7c9607272e755ca9027f1a12fca025ff9aae 100644
|
| --- a/chrome/browser/plugins/plugins_field_trial.cc
|
| +++ b/components/content_settings/core/browser/plugins_field_trial.cc
|
| @@ -2,12 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/plugins/plugins_field_trial.h"
|
| +#include "components/content_settings/core/browser/plugins_field_trial.h"
|
|
|
| #include "base/command_line.h"
|
| #include "base/metrics/field_trial.h"
|
| -#include "chrome/common/chrome_switches.h"
|
| +#include "components/content_settings/core/common/content_settings_switches.h"
|
|
|
| +namespace content_settings {
|
| +
|
| +// static
|
| +const char PluginsFieldTrial::kFieldTrialName[] = "ForcePluginPowerSaver";
|
| +
|
| +// static
|
| ContentSetting PluginsFieldTrial::EffectiveContentSetting(
|
| ContentSettingsType type,
|
| ContentSetting setting) {
|
| @@ -18,23 +24,26 @@ ContentSetting PluginsFieldTrial::EffectiveContentSetting(
|
| if (setting == ContentSetting::CONTENT_SETTING_ASK)
|
| return ContentSetting::CONTENT_SETTING_BLOCK;
|
|
|
| - // For Plugins, allow flag to override displayed content setting.
|
| - if (setting == ContentSetting::CONTENT_SETTING_ALLOW &&
|
| - IsForcePluginPowerSaverEnabled()) {
|
| - return ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
|
| - }
|
| -
|
| return setting;
|
| }
|
|
|
| -bool PluginsFieldTrial::IsForcePluginPowerSaverEnabled() {
|
| +// static
|
| +bool PluginsFieldTrial::IsPluginPowerSaverEnabled() {
|
| const base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
|
| if (cl->HasSwitch(switches::kDisablePluginPowerSaver))
|
| return false;
|
| if (cl->HasSwitch(switches::kEnablePluginPowerSaver))
|
| return true;
|
|
|
| - std::string group_name =
|
| - base::FieldTrialList::FindFullName("ForcePluginPowerSaver");
|
| + std::string group_name = base::FieldTrialList::FindFullName(kFieldTrialName);
|
| return !group_name.empty() && group_name != "Disabled";
|
| }
|
| +
|
| +// static
|
| +ContentSetting PluginsFieldTrial::GetDefaultPluginsContentSetting() {
|
| + return IsPluginPowerSaverEnabled() ?
|
| + ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT :
|
| + ContentSetting::CONTENT_SETTING_ALLOW;
|
| +}
|
| +
|
| +} // namespace content_settings
|
|
|