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

Unified Diff: chrome/browser/plugins/plugins_field_trial.cc

Issue 1033103002: Plugin Power Saver: Overhaul plugin-power-saver flags. Show in UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: chrome/browser/plugins/plugins_field_trial.cc
diff --git a/chrome/browser/plugins/plugins_field_trial.cc b/chrome/browser/plugins/plugins_field_trial.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a526f00295a9a4784cd0c8f3d4783a0c28285f4
--- /dev/null
+++ b/chrome/browser/plugins/plugins_field_trial.cc
@@ -0,0 +1,40 @@
+// 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 "chrome/browser/plugins/plugins_field_trial.h"
+
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "chrome/common/chrome_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 &&
+ IsForcePluginPowerSaverEnabled()) {
+ return ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
+ }
+
+ return setting;
+}
+
+bool PluginsFieldTrial::IsForcePluginPowerSaverEnabled() {
+ 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");
+ return !group_name.empty() && group_name != "Disabled";
+}
« no previous file with comments | « chrome/browser/plugins/plugins_field_trial.h ('k') | chrome/browser/resources/options/content_settings.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698