Index: components/content_settings/core/browser/content_settings_global_value_map.h |
diff --git a/components/content_settings/core/browser/content_settings_binary_value_map.h b/components/content_settings/core/browser/content_settings_global_value_map.h |
similarity index 51% |
rename from components/content_settings/core/browser/content_settings_binary_value_map.h |
rename to components/content_settings/core/browser/content_settings_global_value_map.h |
index dbce8982bc18fe55cbff25168c1a57c401363f59..99407a1ab08abf94f397c8fca1b219312c8d4d4e 100644 |
--- a/components/content_settings/core/browser/content_settings_binary_value_map.h |
+++ b/components/content_settings/core/browser/content_settings_global_value_map.h |
@@ -2,43 +2,42 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_BINARY_VALUE_MAP_H_ |
-#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_BINARY_VALUE_MAP_H_ |
+#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_GLOBAL_VALUE_MAP_H_ |
+#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_GLOBAL_VALUE_MAP_H_ |
#include <map> |
#include "components/content_settings/core/browser/content_settings_provider.h" |
#include "components/content_settings/core/common/content_settings_types.h" |
-namespace base { |
-class AutoLock; |
-} // namespace base |
- |
namespace content_settings { |
class RuleIterator; |
-// A simplified value map that can be used to disable or enable the entire |
-// Content Setting. The default behaviour is enabling the Content Setting if |
-// it is not set explicitly. |
-class BinaryValueMap { |
+// A simplified value map that sets global content settings, i.e. applying to |
+// all sites. |
+// Note that this class does not do any synchronization. As content settings are |
+// accessed from multiple threads, it's the responsibility of the client to |
+// prevent concurrent access. |
+class GlobalValueMap { |
public: |
- BinaryValueMap(); |
- ~BinaryValueMap(); |
+ GlobalValueMap(); |
+ ~GlobalValueMap(); |
// Returns nullptr to indicate the RuleIterator is empty. |
std::unique_ptr<RuleIterator> GetRuleIterator( |
ContentSettingsType content_type, |
- const ResourceIdentifier& resource_identifier, |
- std::unique_ptr<base::AutoLock> lock) const; |
- void SetContentSettingDisabled(ContentSettingsType content_type, |
- bool disabled); |
- bool IsContentSettingEnabled(ContentSettingsType content_type) const; |
+ const ResourceIdentifier& resource_identifier) const; |
+ void SetContentSetting(ContentSettingsType content_type, |
+ ContentSetting setting); |
+ ContentSetting GetContentSetting(ContentSettingsType content_type) const; |
private: |
- std::map<ContentSettingsType, bool> is_enabled_; |
+ std::map<ContentSettingsType, ContentSetting> settings_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GlobalValueMap); |
}; |
} // namespace content_settings |
-#endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_BINARY_VALUE_MAP_H_ |
+#endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_GLOBAL_VALUE_MAP_H_ |