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

Unified Diff: chrome/browser/host_content_settings_map.cc

Issue 5238002: Reintegrate 552 r66225-r66645.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/552d/src/
Patch Set: '' 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
===================================================================
--- chrome/browser/host_content_settings_map.cc (revision 66837)
+++ chrome/browser/host_content_settings_map.cc (working copy)
@@ -99,6 +99,20 @@
url.SchemeIs(chrome::kGearsScheme) ||
url.SchemeIs(chrome::kUserScriptScheme);
}
+
+// Map ASK for the plugins content type to BLOCK if click-to-play is
+// not enabled.
+ContentSetting 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;
+}
+
} // namespace
// static
@@ -450,6 +464,10 @@
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.
@@ -492,6 +510,10 @@
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));
bool early_exit = false;
std::string pattern_str(pattern.AsString());
@@ -805,6 +827,10 @@
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(
@@ -829,7 +855,8 @@
DCHECK(found);
(*settings)[ContentSettingsTypeResourceIdentifierPair(
ContentSettingsType(type), resource_identifier)] =
- ContentSetting(setting);
+ ClickToPlayFixup(ContentSettingsType(type),
+ ContentSetting(setting));
}
break;
« no previous file with comments | « chrome/browser/gtk/options/content_filter_page_gtk.cc ('k') | chrome/browser/host_content_settings_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698