 Chromium Code Reviews
 Chromium Code Reviews Issue 6253012:
  Add ContentSettingsProvider Interface.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 6253012:
  Add ContentSettingsProvider Interface.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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..dfabb35bbacf6b466b209e98b758f7d45a7ad82c 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), | 
| + embedding_url_pattern_(embedding_url_pattern), | 
| + content_setting_(setting) {} | 
| + | 
| + const ContentSettingsPattern requesting_url_pattern_; | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
no _ at the end of member variables (since this is
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + 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, | 
| + const ContentSettingsType& content_type, | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
ContentSettingsType doesn't need to be const nor a
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + const ResourceIdentifier& resource_identifier) const = 0; | 
| + | 
| + // Sets the content setting for a particular |requesting_pattern|, | 
| + // |embedding_pattern|, |content_type| tupel. For ContentSettingsTypes that | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
nit. tuple
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + // 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, | 
| + const ContentSettingsType& content_type, | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
same here
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + 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 a non-NULL outparam. If this map was | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
must be non-NULL. (no outparam)
map -> provider
 
markusheintz_
2011/02/01 11:34:38
map -> user pref provider
 | 
| + // created for the off-the-record profile, it will only return those settings | 
| + // differing from the main map. For ContentSettingsTypes that require a | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
main map -> corresponding regular provider
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + // resource identifier to be specified, the |resource_identifier| must be | 
| + // non-empty. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual void GetAllContentSettingsRules( | 
| + const ContentSettingsType& content_type, | 
| 
jochen (gone - plz use gerrit)
2011/02/01 11:22:35
same here
 
markusheintz_
2011/02/01 11:34:38
Done.
 | 
| + 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_ |