Index: chrome/browser/content_settings/host_content_settings_map.cc |
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc |
index f05ef0acdc5b38d317b108dac41eff3454b53e6f..2493d81647262b4bc5d2ebe2b5ad98c631be57dd 100644 |
--- a/chrome/browser/content_settings/host_content_settings_map.cc |
+++ b/chrome/browser/content_settings/host_content_settings_map.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/content_settings/host_content_settings_map.h" |
+#include <algorithm> |
#include <list> |
#include "base/command_line.h" |
@@ -384,6 +385,38 @@ void HostContentSettingsMap::GetSettingsForOneType( |
} |
} |
+void HostContentSettingsMap::GetConcatenatedSettingsForOneType( |
+ ContentSettingsType content_type, |
+ const std::string& resource_identifier, |
+ ContentSettingRules* rules) const { |
+ DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), |
+ resource_identifier.empty()); |
+ DCHECK(rules); |
+ |
+ rules->clear(); |
+ for (size_t i = 0; i < content_settings_providers_.size(); ++i) { |
+ // Get rules from the content settings provider. |
+ Rules rules_for_provider; |
+ content_settings_providers_[i]->GetAllContentSettingsRules( |
+ content_type, resource_identifier, &rules_for_provider); |
+ |
+ // The rules are returned in arbitrary order. Sort them according to the |
+ // ContentSettingPattern precedence relation. |
Bernhard Bauer
2011/09/13 17:38:11
Uhhh… is this going to work? The precedence relati
marja
2011/09/15 12:02:00
Hmm, what would go wrong? Sorting should be ok eve
Bernhard Bauer
2011/09/15 12:52:19
Hm, I guess the most important property is transit
marja
2011/09/15 16:00:03
markusheintz had some diabolic-soul-merchandise go
|
+ std::sort(rules_for_provider.begin(), rules_for_provider.end()); |
+ |
+ for (Rules::const_iterator i = rules_for_provider.begin(); |
+ i != rules_for_provider.end(); ++i) { |
+ rules->push_back(ContentSettingPatternTuple(i->primary_pattern, |
+ i->secondary_pattern, |
+ i->content_setting)); |
+ } |
+ } |
+ rules->push_back(ContentSettingPatternTuple( |
+ ContentSettingsPattern::Wildcard(), |
+ ContentSettingsPattern::Wildcard(), |
+ GetDefaultContentSetting(content_type))); |
+} |
+ |
void HostContentSettingsMap::SetDefaultContentSetting( |
ContentSettingsType content_type, |
ContentSetting setting) { |