 Chromium Code Reviews
 Chromium Code Reviews Issue 6242013:
  Add LegacyContentSettingsProvider Interface.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 6242013:
  Add LegacyContentSettingsProvider 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 e791eaddade8f36ac72730fd3a733fcc4805e030..86b9b4239a66672da00ce4ba835f55d86b31599f 100644 | 
| --- a/chrome/browser/content_settings/content_settings_provider.h | 
| +++ b/chrome/browser/content_settings/content_settings_provider.h | 
| @@ -8,7 +8,11 @@ | 
| #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 
| #pragma once | 
| +#include <vector> | 
| + | 
| +#include "chrome/browser/content_settings/content_settings_pattern.h" | 
| #include "chrome/common/content_settings.h" | 
| +#include "googleurl/src/gurl.h" | 
| 
Bernhard Bauer
2011/01/26 14:50:47
Forward-declare GURL?
 
markusheintz_
2011/01/26 16:27:47
Done.
 | 
| class DefaultContentSettingsProvider { | 
| public: | 
| @@ -39,4 +43,96 @@ class DefaultContentSettingsProvider { | 
| ContentSettingsType content_type) const = 0; | 
| }; | 
| +class LegacyContentSettingsProvider { | 
| + public: | 
| + | 
| 
Bernhard Bauer
2011/01/26 14:50:47
Remove blank line.
Also, you should add a virtual
 
markusheintz_
2011/01/26 16:27:47
Done.
 | 
| + // LEGACY ContentSettingsProvider interface | 
| + | 
| + typedef std::pair<ContentSettingsPattern, ContentSetting> PatternSettingPair; | 
| + typedef std::vector<PatternSettingPair> SettingsForOneType; | 
| + | 
| + // Returns a single ContentSetting which applies to a given URL. Note that | 
| + // certain internal schemes are whitelisted. For ContentSettingsTypes that | 
| + // require an resource identifier to be specified, the |resource_identifier| | 
| + // must be non-empty. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual ContentSetting GetContentSetting( | 
| + const GURL& url, | 
| + ContentSettingsType content_type, | 
| + const std::string& resource_identifier) const = 0; | 
| + | 
| + // Returns a single ContentSetting which applies to a given URL or | 
| + // CONTENT_SETTING_DEFAULT, if no exception applies. Note that certain | 
| + // internal schemes are whitelisted. For ContentSettingsTypes that require an | 
| + // resource identifier to be specified, the |resource_identifier| must be | 
| + // non-empty. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual ContentSetting GetNonDefaultContentSetting( | 
| + const GURL& url, | 
| + ContentSettingsType content_type, | 
| + const std::string& resource_identifier) const = 0; | 
| + | 
| + // Returns all ContentSettings which apply to a given URL. For content | 
| + // setting types that require an additional resource identifier, the default | 
| + // content setting is returned. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual ContentSettings GetContentSettings(const GURL& url) const = 0; | 
| + | 
| + // Returns all non-default ContentSettings which apply to a given URL. For | 
| + // content setting types that require an additional resource identifier, | 
| + // CONTENT_SETTING_DEFAULT is returned. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual ContentSettings GetNonDefaultContentSettings(const GURL& url) const = 0; | 
| 
Bernhard Bauer
2011/01/26 14:50:47
80 cols
 
markusheintz_
2011/01/26 16:27:47
Done.
 | 
| + | 
| + // For a given content type, returns all patterns with a non-default setting, | 
| + // mapped to their actual settings, in lexicographical order. |settings| | 
| + // must be a non-NULL outparam. If this map was created for the | 
| + // off-the-record profile, it will only return those settings differing from | 
| + // the main map. For ContentSettingsTypes that require an resource identifier | 
| + // to be specified, the |resource_identifier| must be non-empty. | 
| + // | 
| + // This may be called on any thread. | 
| + virtual void GetSettingsForOneType(ContentSettingsType content_type, | 
| + const std::string& resource_identifier, | 
| 
Bernhard Bauer
2011/01/26 14:50:47
Methinks your editor is indent-technically challen
 
markusheintz_
2011/01/26 16:27:47
Done.
 | 
| + SettingsForOneType* settings) const = 0; | 
| + | 
| + // Sets the blocking setting for a particular pattern and content type. | 
| + // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting | 
| + // for that type to be used when loading pages matching this pattern. For | 
| + // ContentSettingsTypes that require an 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& pattern, | 
| + ContentSettingsType content_type, | 
| + const std::string& resource_identifier, | 
| + ContentSetting setting) = 0; | 
| + | 
| + // Convenience method to add a content setting for a given URL, making sure | 
| + // that there is no setting overriding it. For ContentSettingsTypes that | 
| + // require an resource identifier to be specified, the |resource_identifier| | 
| + // must be non-empty. | 
| + // | 
| + // This should only be called on the UI thread. | 
| + virtual void AddExceptionForURL(const GURL& url, | 
| + ContentSettingsType content_type, | 
| + const std::string& resource_identifier, | 
| + ContentSetting setting) = 0; | 
| + | 
| + // Clears all host-specific settings for one content type. | 
| + // | 
| + // This should only be called on the UI thread. | 
| + virtual void ClearSettingsForOneType(ContentSettingsType content_type) = 0; | 
| + | 
| + // Resets all settings levels. | 
| + // | 
| + // This should only be called on the UI thread. | 
| + virtual void ResetToDefaults() = 0; | 
| + | 
| 
Bernhard Bauer
2011/01/26 14:50:47
Remove blank line
 
markusheintz_
2011/01/26 16:27:47
Done.
 | 
| +}; | 
| + | 
| #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |