OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const content_settings::ResourceIdentifier& identifier, | 103 const content_settings::ResourceIdentifier& identifier, |
104 ContentSetting setting, | 104 ContentSetting setting, |
105 ExtensionPrefsScope scope) { | 105 ExtensionPrefsScope scope) { |
106 { | 106 { |
107 base::AutoLock lock(lock_); | 107 base::AutoLock lock(lock_); |
108 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); | 108 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); |
109 if (setting == CONTENT_SETTING_DEFAULT) { | 109 if (setting == CONTENT_SETTING_DEFAULT) { |
110 map->DeleteValue(primary_pattern, secondary_pattern, type, identifier); | 110 map->DeleteValue(primary_pattern, secondary_pattern, type, identifier); |
111 } else { | 111 } else { |
112 map->SetValue(primary_pattern, secondary_pattern, type, identifier, | 112 map->SetValue(primary_pattern, secondary_pattern, type, identifier, |
113 new base::FundamentalValue(setting)); | 113 new base::Value(setting)); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 // Send notification that content settings changed. (Note: This is responsible | 117 // Send notification that content settings changed. (Note: This is responsible |
118 // for updating the pref store, so cannot be skipped even if the setting would | 118 // for updating the pref store, so cannot be skipped even if the setting would |
119 // be masked by another extension.) | 119 // be masked by another extension.) |
120 NotifyOfContentSettingChanged(ext_id, | 120 NotifyOfContentSettingChanged(ext_id, |
121 scope != kExtensionPrefsScopeRegular); | 121 scope != kExtensionPrefsScopeRegular); |
122 } | 122 } |
123 | 123 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 ContentSettingsStore::ExtensionEntries::iterator | 384 ContentSettingsStore::ExtensionEntries::iterator |
385 ContentSettingsStore::FindIterator(const std::string& ext_id) { | 385 ContentSettingsStore::FindIterator(const std::string& ext_id) { |
386 return std::find_if(entries_.begin(), entries_.end(), | 386 return std::find_if(entries_.begin(), entries_.end(), |
387 [ext_id](const std::unique_ptr<ExtensionEntry>& entry) { | 387 [ext_id](const std::unique_ptr<ExtensionEntry>& entry) { |
388 return entry->id == ext_id; | 388 return entry->id == ext_id; |
389 }); | 389 }); |
390 } | 390 } |
391 | 391 |
392 } // namespace extensions | 392 } // namespace extensions |
OLD | NEW |