Chromium Code Reviews| Index: chrome/browser/content_settings/content_settings_provider.h |
| diff --git a/chrome/browser/content_settings/content_settings_provider.h b/chrome/browser/content_settings/content_settings_provider.h |
| index b330db82d922028e5fbaa1945dae9dc6606f2909..e5e10cb508cff582590fe410ed700948fef0f8bf 100644 |
| --- a/chrome/browser/content_settings/content_settings_provider.h |
| +++ b/chrome/browser/content_settings/content_settings_provider.h |
| @@ -8,8 +8,14 @@ |
| #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| #pragma once |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "chrome/browser/content_settings/content_settings_pattern.h" |
| #include "chrome/common/content_settings.h" |
| +class GURL; |
| + |
| namespace content_settings { |
| class DefaultProviderInterface { |
| @@ -41,6 +47,73 @@ class DefaultProviderInterface { |
| ContentSettingsType content_type) const = 0; |
| }; |
| +class ProviderInterface { |
| + public: |
| + typedef std::string ResourceIdentifier; |
| + |
| + struct Rule { |
| + Rule() {} |
| + Rule(const ContentSettingsPattern& requesting_url_pattern, |
| + const ContentSettingsPattern& embedding_url_pattern, |
| + ContentSetting& setting) |
| + : requesting_url_pattern_(requesting_url_pattern), |
|
jochen (gone - plz use gerrit)
2011/02/01 11:38:39
also remove the underscores here
markusheintz_
2011/02/01 12:17:12
Done.
|
| + embedding_url_pattern_(embedding_url_pattern), |
| + content_setting_(setting) {} |
| + |
| + const ContentSettingsPattern requesting_url_pattern; |
| + const ContentSettingsPattern embedding_url_pattern; |
| + ContentSetting content_setting; |
| + }; |
| + |
| + typedef std::vector<Rule> Rules; |
| + |
| + virtual ~ProviderInterface() {} |
| + |
| + // Returns a single ContentSetting which applies to a given |requesting_url|, |
| + // |embedding_url| pair or CONTENT_SETTING_DEFAULT, if no rule applies. For |
| + // ContentSettingsTypes that require a resource identifier to be specified, |
| + // the |resource_identifier| must be non-empty. |
| + // |
| + // This may be called on any thread. |
| + virtual ContentSetting GetContentSetting( |
| + const GURL& requesting_url, |
| + const GURL& embedding_url, |
| + ContentSettingsType content_type, |
| + const ResourceIdentifier& resource_identifier) const = 0; |
| + |
| + // Sets the content setting for a particular |requesting_pattern|, |
| + // |embedding_pattern|, |content_type| tuple. For ContentSettingsTypes that |
| + // require a resource identifier to be specified, the |resource_identifier| |
| + // must be non-empty. |
| + // |
| + // This should only be called on the UI thread. |
| + virtual void SetContentSetting( |
| + const ContentSettingsPattern& requesting_pattern, |
| + const ContentSettingsPattern& embedding_pattern, |
| + ContentSettingsType content_type, |
| + const ResourceIdentifier& resource_identifier, |
| + ContentSetting content_setting) = 0; |
| + |
| + // For a given content type, returns all content setting rules with a |
| + // non-default setting, mapped to their actual settings. |
| + // |content_settings_rules| must be non-NULL. If this provider was created for |
| + // the off-the-record profile, it will only return those settings differing |
| + // from the corresponding regular provider. For ContentSettingsTypes that |
| + // require a resource identifier to be specified, the |resource_identifier| |
| + // must be non-empty. |
| + // |
| + // This may be called on any thread. |
| + virtual void GetAllContentSettingsRules( |
| + ContentSettingsType content_type, |
| + const ResourceIdentifier& resource_identifier, |
| + Rules* content_setting_rules) const = 0; |
| + |
| + // Resets all content settings to CONTENT_SETTING_DEFAULT. |
| + // |
| + // This should only be called on the UI thread. |
| + virtual void ClearAllContentSettingsRules() = 0; |
| +}; |
| + |
| } // namespace content_settings |
| #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |