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

Unified Diff: chrome/browser/host_content_settings_map.cc

Issue 4643007: Move click-to-play to about:flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 10 years, 1 month 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/host_content_settings_map.cc
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index a7dda7e68810ccbfcb0da4c38b1f4310214a2220..d712952e04fad5fcc2898dc98e438ba6d93f4b67 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -391,6 +391,18 @@ ContentSettings HostContentSettingsMap::GetNonDefaultContentSettings(
return output;
}
+ContentSetting HostContentSettingsMap::ClickToPlayFixup(
+ ContentSettingsType content_type,
+ ContentSetting setting) {
+ if (setting == CONTENT_SETTING_ASK &&
+ content_type == CONTENT_SETTINGS_TYPE_PLUGINS &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay)) {
+ return CONTENT_SETTING_BLOCK;
+ }
+ return setting;
+}
+
void HostContentSettingsMap::GetSettingsForOneType(
ContentSettingsType content_type,
const std::string& resource_identifier,
@@ -432,6 +444,10 @@ void HostContentSettingsMap::SetDefaultContentSetting(
ContentSetting setting) {
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(content_type != CONTENT_SETTINGS_TYPE_PLUGINS ||
+ setting != CONTENT_SETTING_ASK ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay));
PrefService* prefs = profile_->GetPrefs();
// The default settings may not be directly modified for OTR sessions.
@@ -474,6 +490,10 @@ void HostContentSettingsMap::SetContentSetting(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_NE(RequiresResourceIdentifier(content_type),
resource_identifier.empty());
+ DCHECK(content_type != CONTENT_SETTINGS_TYPE_PLUGINS ||
+ setting != CONTENT_SETTING_ASK ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay));
const Pattern pattern(original_pattern.CanonicalizePattern());
@@ -796,6 +816,10 @@ void HostContentSettingsMap::GetSettingsFromDictionary(
if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] ==
CONTENT_SETTING_ASK)
settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK;
+
+ settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
+ ClickToPlayFixup(CONTENT_SETTINGS_TYPE_PLUGINS,
+ settings->settings[CONTENT_SETTINGS_TYPE_PLUGINS]);
}
void HostContentSettingsMap::GetResourceSettingsFromDictionary(
@@ -820,7 +844,8 @@ void HostContentSettingsMap::GetResourceSettingsFromDictionary(
DCHECK(found);
(*settings)[ContentSettingsTypeResourceIdentifierPair(
ContentSettingsType(type), resource_identifier)] =
- ContentSetting(setting);
+ ClickToPlayFixup(ContentSettingsType(type),
+ ContentSetting(setting));
}
break;

Powered by Google App Engine
This is Rietveld 408576698