Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5395)

Unified Diff: chrome/browser/content_settings/content_settings_provider.h

Issue 6253012: Add ContentSettingsProvider Interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e968546f6772569ee90ccdb5ba32657b9ecd6a60 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_pattern,
+ const ContentSettingsPattern& embedding_pattern,
+ ContentSetting setting)
+ : requesting_url_pattern(requesting_pattern),
jochen (gone - plz use gerrit) 2011/02/01 12:33:11 nit. you can use requesting_url_pattern both times
markusheintz_ 2011/02/01 12:38:01 Ah cool! :-) THANKS.
+ embedding_url_pattern(embedding_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,
jochen (gone - plz use gerrit) 2011/02/01 12:33:11 nit. requesting_url_pattern and embedding_url_patt
markusheintz_ 2011/02/01 12:38:01 Done.
+ 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_

Powered by Google App Engine
This is Rietveld 408576698