| Index: components/plugins/common/plugins_field_trial.cc
|
| diff --git a/components/plugins/common/plugins_field_trial.cc b/components/plugins/common/plugins_field_trial.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c48e9534ea5be8696a392a5b5bdeebd1d6bf87cd
|
| --- /dev/null
|
| +++ b/components/plugins/common/plugins_field_trial.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/plugins/common/plugins_field_trial.h"
|
| +
|
| +#include "base/command_line.h"
|
| +#include "base/metrics/field_trial.h"
|
| +#include "components/plugins/common/plugins_switches.h"
|
| +
|
| +ContentSetting PluginsFieldTrial::EffectiveContentSetting(
|
| + ContentSettingsType type,
|
| + ContentSetting setting) {
|
| + if (type != CONTENT_SETTINGS_TYPE_PLUGINS)
|
| + return setting;
|
| +
|
| + // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior.
|
| + 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 &&
|
| + EnableForcePluginPowerSaver()) {
|
| + return ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
|
| + }
|
| +
|
| + return setting;
|
| +}
|
| +
|
| +bool PluginsFieldTrial::EnableForcePluginPowerSaver() {
|
| + const base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
|
| + if (cl->HasSwitch(switches::kDisablePluginPowerSaver))
|
| + return false;
|
| + if (cl->HasSwitch(switches::kEnablePluginPowerSaver))
|
| + return true;
|
| +
|
| + return base::FieldTrialList::FindFullName("ForcePluginPowerSaver") ==
|
| + "Enabled";
|
| +}
|
|
|