diff options
author | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-05 09:05:19 +0000 |
---|---|---|
committer | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-05 09:05:19 +0000 |
commit | 5758a947293b9429378f1782f808567ccde38ea5 (patch) | |
tree | 66d2a86e696ad53dde0e046970462c1409607910 /chrome/browser/content_settings | |
parent | 933dbd9db0e34f41114359fb7dd4ad31dea3b2ba (diff) | |
download | chromium_src-5758a947293b9429378f1782f808567ccde38ea5.zip chromium_src-5758a947293b9429378f1782f808567ccde38ea5.tar.gz chromium_src-5758a947293b9429378f1782f808567ccde38ea5.tar.bz2 |
Remove ContentSettingsRule and ContentSettingsRules types in content_settings::PolicyProvider.
The change removes one step in the process of loading managed (= by policy) content settings form the preferences that store the policy values. Instead of loading the content settings into a vector and passing this vector to another method that stores the content settings in the in-memory map , content settings are directly stored in the in-memory map. This eliminates one pass over all content settings. That is not needed.
BUG=63656
TEST=content_settings_policy_provider_unittests.cc
Review URL: http://codereview.chromium.org/7811019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_settings')
-rw-r--r-- | chrome/browser/content_settings/content_settings_policy_provider.cc | 19 | ||||
-rw-r--r-- | chrome/browser/content_settings/content_settings_policy_provider.h | 11 |
2 files changed, 6 insertions, 24 deletions
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc index 4b135b8..47b6b59 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider.cc @@ -309,7 +309,7 @@ PolicyProvider::~PolicyProvider() { } void PolicyProvider::GetContentSettingsFromPreferences( - ContentSettingsRules* rules) { + OriginIdentifierValueMap* value_map) { for (size_t i = 0; i < arraysize(kPrefsForManagedContentSettingsMap); ++i) { const char* pref_name = kPrefsForManagedContentSettingsMap[i].pref_name; // Skip unset policies. @@ -345,32 +345,23 @@ void PolicyProvider::GetContentSettingsFromPreferences( ContentSettingsPattern secondary_pattern = !pattern_pair.second.IsValid() ? ContentSettingsPattern::Wildcard() : pattern_pair.second; - rules->push_back(MakeTuple( + value_map->SetValue( pattern_pair.first, secondary_pattern, content_type, ResourceIdentifier(NO_RESOURCE_IDENTIFIER), - kPrefsForManagedContentSettingsMap[i].setting)); + static_cast<Value*>(Value::CreateIntegerValue( + kPrefsForManagedContentSettingsMap[i].setting))); } } } void PolicyProvider::ReadManagedContentSettings(bool overwrite) { - ContentSettingsRules rules; - GetContentSettingsFromPreferences(&rules); { base::AutoLock auto_lock(lock_); if (overwrite) value_map_.clear(); - for (ContentSettingsRules::iterator rule = rules.begin(); - rule != rules.end(); - ++rule) { - value_map_.SetValue(rule->a, - rule->b, - rule->c, - rule->d, - Value::CreateIntegerValue(rule->e)); - } + GetContentSettingsFromPreferences(&value_map_); } } diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h index ab72012..ae7a82c 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.h +++ b/chrome/browser/content_settings/content_settings_policy_provider.h @@ -107,18 +107,9 @@ class PolicyProvider : public ObservableProvider, const NotificationSource& source, const NotificationDetails& details); private: - typedef Tuple5< - ContentSettingsPattern, - ContentSettingsPattern, - ContentSettingsType, - ResourceIdentifier, - ContentSetting> ContentSettingsRule; - - typedef std::vector<ContentSettingsRule> ContentSettingsRules; - void ReadManagedContentSettings(bool overwrite); - void GetContentSettingsFromPreferences(ContentSettingsRules* rules); + void GetContentSettingsFromPreferences(OriginIdentifierValueMap* rules); void ReadManagedContentSettingsTypes(ContentSettingsType content_type); |