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

Unified Diff: chrome/browser/content_settings/content_settings_base_provider.cc

Issue 6542048: Add content_settings::PolicyProvider and a set of new policies to managed content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 10 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/content_settings/content_settings_base_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_base_provider.cc b/chrome/browser/content_settings/content_settings_base_provider.cc
index 6bc3d66b39e416f5c246911479e89b2886307dc7..caac20f85ccca51aa1a2579097f00c061cecf162 100644
--- a/chrome/browser/content_settings/content_settings_base_provider.cc
+++ b/chrome/browser/content_settings/content_settings_base_provider.cc
@@ -150,6 +150,7 @@ void BaseProvider::GetAllContentSettingsRules(
ContentSettingsType content_type,
const ResourceIdentifier& resource_identifier,
Rules* content_setting_rules) const {
+ //TODO
Bernhard Bauer 2011/02/23 13:18:53 Please expand.
markusheintz_ 2011/02/23 18:42:09 Fixed the TODO
DCHECK(RequiresResourceIdentifier(content_type) !=
resource_identifier.empty());
DCHECK(content_setting_rules);
@@ -237,6 +238,45 @@ ContentSettings BaseProvider::GetNonDefaultContentSettings(
return output;
}
+void BaseProvider::UpdateContentSettingsMap(
+ const ContentSettingsPattern& requesting_pattern,
+ const ContentSettingsPattern& embedding_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier,
+ ContentSetting content_setting) {
+ std::string pattern_str(requesting_pattern.CanonicalizePattern());
Bernhard Bauer 2011/02/23 13:18:53 I think you could move this down and get rid of th
markusheintz_ 2011/02/23 18:42:09 Yep. Done
+ {
+ base::AutoLock auto_lock(lock());
+
+ HostContentSettings* content_settings_map = host_content_settings();
+
+ if (!content_settings_map->count(pattern_str)) {
+ (*content_settings_map)[pattern_str].content_settings = ContentSettings();
Bernhard Bauer 2011/02/23 13:18:53 Is this necessary? Shouldn't an empty ContentSetti
markusheintz_ 2011/02/23 18:42:09 True.
+ }
+ HostContentSettings::iterator i(
+ content_settings_map->find(pattern_str));
+ if (RequiresResourceIdentifier(content_type)) {
+ i->second.content_settings.settings[content_type] =
+ CONTENT_SETTING_DEFAULT;
+
+ ResourceContentSettings& content_settings_for_resources =
+ i->second.content_settings_for_resources;
+ if (content_setting != CONTENT_SETTING_DEFAULT) {
+ content_settings_for_resources[
+ ContentSettingsTypeResourceIdentifierPair(content_type,
+ resource_identifier)] = content_setting;
+ } else {
+ content_settings_for_resources.erase(
+ ContentSettingsTypeResourceIdentifierPair(content_type,
+ resource_identifier));
+ }
+ } else {
+ ContentSettings& content_settings = i->second.content_settings;
Bernhard Bauer 2011/02/23 13:18:53 Inline this local variable?
markusheintz_ 2011/02/23 18:42:09 Done.
+ content_settings.settings[content_type] = content_setting;
+ }
+ }
+}
+
// static
ContentSetting BaseProvider::ClickToPlayFixup(ContentSettingsType content_type,
ContentSetting setting) {

Powered by Google App Engine
This is Rietveld 408576698