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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.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: fix gypi i hope 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/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 562ea7cf2c59b810e42de1a2f39317f35fe350e0..4ead795080532a310f58ed56e9658b0bf0bee821 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -24,7 +23,6 @@
#include "chrome/browser/notifications/desktop_notification_profile_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -36,6 +34,7 @@
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/google/core/browser/google_util.h"
+#include "components/plugins/common/plugins_field_trial.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/notification_service.h"
@@ -528,6 +527,12 @@ void ContentSettingsHandler::InitializePage() {
UpdateHandlersEnabledRadios();
UpdateAllExceptionsViewsFromModel();
UpdateProtectedContentExceptionsButton();
+
+ // For Plugins, allow flag to override displayed content setting.
+ if (PluginsFieldTrial::EnableForcePluginPowerSaver()) {
+ web_ui()->CallJavascriptFunction(
+ "ContentSettings.disablePluginsAllowOption");
+ }
}
void ContentSettingsHandler::OnContentSettingChanged(
@@ -606,10 +611,16 @@ void ContentSettingsHandler::UpdateSettingDefaultFromModel(
ContentSetting default_setting =
GetContentSettingsMap()->GetDefaultContentSetting(type, &provider_id);
- // For Plugins, display the obsolete ASK setting as BLOCK.
- if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS &&
- default_setting == ContentSetting::CONTENT_SETTING_ASK) {
- default_setting = ContentSetting::CONTENT_SETTING_BLOCK;
+ // For Plugins, allow flag to override displayed content setting.
+ // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior.
+ if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS) {
+ if (default_setting == ContentSetting::CONTENT_SETTING_ALLOW &&
+ PluginsFieldTrial::EnableForcePluginPowerSaver()) {
+ default_setting =
+ ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
+ } else if (default_setting == ContentSetting::CONTENT_SETTING_ASK) {
+ default_setting = ContentSetting::CONTENT_SETTING_BLOCK;
+ }
}
base::DictionaryValue filter_settings;

Powered by Google App Engine
This is Rietveld 408576698