Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: components/content_settings/core/browser/plugins_field_trial.cc

Issue 1084123002: Make DETECT_IMPORTANT_CONTENT the default Plugins content setting based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp shuffle for ios Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/content_settings/core/browser/plugins_field_trial.cc
diff --git a/components/content_settings/core/browser/plugins_field_trial.cc b/components/content_settings/core/browser/plugins_field_trial.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98cd97a75487dd9a176d7e0e7d49a469475233cf
--- /dev/null
+++ b/components/content_settings/core/browser/plugins_field_trial.cc
@@ -0,0 +1,49 @@
+// 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/content_settings/core/browser/plugins_field_trial.h"
+
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "components/plugins/common/plugins_switches.h"
+
+namespace content_settings {
+
+// static
+const char PluginsFieldTrial::kFieldTrialName[] = "ForcePluginPowerSaver";
+
+// static
+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;
+
+ return setting;
+}
+
+// static
+bool PluginsFieldTrial::IsPluginPowerSaverEnabled() {
+ const base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+ if (cl->HasSwitch(plugins::switches::kDisablePluginPowerSaver))
+ return false;
+ if (cl->HasSwitch(plugins::switches::kEnablePluginPowerSaver))
+ return true;
+
+ 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

Powered by Google App Engine
This is Rietveld 408576698