Index: chrome/browser/content_settings/host_content_settings_map.h |
diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h |
index 1b05880c57e3ab022013feb90ae3b088990e24a8..16411ec43d01d6844d2096ef2ff783cfda28ef19 100644 |
--- a/chrome/browser/content_settings/host_content_settings_map.h |
+++ b/chrome/browser/content_settings/host_content_settings_map.h |
@@ -8,12 +8,12 @@ |
#ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
#define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
-#include <map> |
#include <string> |
#include <vector> |
#include "base/basictypes.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_vector.h" |
#include "base/observer_list.h" |
#include "base/prefs/pref_change_registrar.h" |
#include "base/threading/platform_thread.h" |
@@ -33,6 +33,8 @@ class Value; |
} |
namespace content_settings { |
+class DefaultProvider; |
+class ObservableProvider; |
class ProviderInterface; |
class PrefProvider; |
} |
@@ -45,26 +47,20 @@ class HostContentSettingsMap |
: public content_settings::Observer, |
public base::RefCountedThreadSafe<HostContentSettingsMap> { |
public: |
- enum ProviderType { |
- INTERNAL_EXTENSION_PROVIDER = 0, |
- POLICY_PROVIDER, |
- CUSTOM_EXTENSION_PROVIDER, |
- PREF_PROVIDER, |
- DEFAULT_PROVIDER, |
- NUM_PROVIDER_TYPES, |
- }; |
- |
HostContentSettingsMap(PrefService* prefs, bool incognito); |
-#if defined(ENABLE_EXTENSIONS) |
- // In some cases, the ExtensionService is not available at the time the |
- // HostContentSettingsMap is constructed. In these cases, we register the |
- // service once it's available. |
- void RegisterExtensionService(ExtensionService* extension_service); |
-#endif |
- |
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
+ // Adds a new provider for |type|. |
+ void RegisterProvider( |
+ scoped_ptr<content_settings::ObservableProvider> provider); |
+ |
+ // Gets the number of providers it has. |
+ size_t GetNumProviders() const; |
+ |
+ // Gets the i-th provider. |
+ const content_settings::ProviderInterface* GetProviderAt(size_t i) const; |
+ |
// Returns the default setting for a particular content type. If |provider_id| |
// is not NULL, the id of the provider which provided the default setting is |
// assigned to it. |
@@ -202,12 +198,6 @@ class HostContentSettingsMap |
const GURL& secondary_url, |
ContentSettingsType content_type); |
- // Returns the ProviderType associated with the given source string. |
- // TODO(estade): I regret adding this. At the moment there are no legitimate |
- // uses. We should stick to ProviderType rather than string so we don't have |
- // to convert backwards. |
- static ProviderType GetProviderTypeFromSource(const std::string& source); |
- |
bool is_off_the_record() const { |
return is_off_the_record_; |
} |
@@ -259,10 +249,9 @@ class HostContentSettingsMap |
friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
friend class HostContentSettingsMapTest_NonDefaultSettings_Test; |
- typedef std::map<ProviderType, content_settings::ProviderInterface*> |
- ProviderMap; |
- typedef ProviderMap::iterator ProviderIterator; |
- typedef ProviderMap::const_iterator ConstProviderIterator; |
+ typedef ScopedVector<content_settings::ProviderInterface> ProviderList; |
+ typedef ProviderList::iterator ProviderIterator; |
+ typedef ProviderList::const_iterator ConstProviderIterator; |
virtual ~HostContentSettingsMap(); |
@@ -280,7 +269,6 @@ class HostContentSettingsMap |
// mode. |
void AddSettingsForOneType( |
const content_settings::ProviderInterface* provider, |
- ProviderType provider_type, |
ContentSettingsType content_type, |
const std::string& resource_identifier, |
ContentSettingsForOneType* settings, |
@@ -292,8 +280,6 @@ class HostContentSettingsMap |
// it is not being called too late. |
void UsedContentSettingsProviders() const; |
- content_settings::PrefProvider* GetPrefProvider(); |
- |
#ifndef NDEBUG |
// This starts as the thread ID of the thread that constructs this |
// object, and remains until used by a different thread, at which |
@@ -313,7 +299,11 @@ class HostContentSettingsMap |
// Content setting providers. This is only modified at construction |
// time and by RegisterExtensionService, both of which should happen |
// before any other uses of it. |
- ProviderMap content_settings_providers_; |
+ ProviderList content_settings_providers_; |
+ |
+ // Keeping the pointers to specific type of the provider. |
+ content_settings::DefaultProvider* default_provider_; |
+ content_settings::PrefProvider* pref_provider_; |
ObserverList<content_settings::Observer> observers_; |