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

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: Fix nits and rename ContentSettingsProviderInterface to ProviderInterface 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a832f4c6b0c72162296f368931e510c57e3188ca 100644
--- a/chrome/browser/content_settings/content_settings_provider.h
+++ b/chrome/browser/content_settings/content_settings_provider.h
@@ -8,11 +8,19 @@
#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 DefaultContentSettingsProvider {
+class GURL;
+
+namespace content_settings {
+
+class DefaultContentSettingsProviderInterface {
public:
- virtual ~DefaultContentSettingsProvider() {}
+ virtual ~DefaultContentSettingsProviderInterface() {}
// True if this provider can provide a default setting for the |content_type|.
virtual bool CanProvideDefaultSetting(
@@ -39,4 +47,56 @@ class DefaultContentSettingsProvider {
ContentSettingsType content_type) const = 0;
};
+class ProviderInterface {
+ public:
+ typedef std::string ResourceIdentifier;
+
+ struct Rule {
Bernhard Bauer 2011/01/27 11:03:48 Sorry to create conflicts with jochen's comments,
+ Rule() {}
+ Rule(const ContentSettingsPattern& requesting_url_pattern,
+ const ContentSettingsPattern& embedding_url_pattern,
+ ContentSetting& setting)
+ : requesting_url_pattern_(requesting_url_pattern),
Bernhard Bauer 2011/01/27 11:03:48 Nit: Indent two more spaces :)
+ 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() {}
+
+ virtual bool ContentSettingsTypeIsManaged(
+ ContentSettingsType content_type) = 0;
+
+ // This may be called on any thread.
+ virtual ContentSetting GetContentSetting(
+ const GURL requesting_url,
+ const GURL embedding_url,
+ const ContentSettingsType& content_type,
+ const ResourceIdentifier& resource_identifier) const = 0;
+
+ // This should only be called on the UI thread.
+ virtual void SetContentSetting(
+ const ContentSettingsPattern& requesting_pattern,
+ const ContentSettingsPattern& embedding_pattern,
+ const ContentSettingsType& content_type,
+ const ResourceIdentifier& resource_identifier,
+ ContentSetting content_setting) = 0;
+
+ // This may be called on any thread.
+ virtual void GetAllContentSettingsRules(
+ const ContentSettingsType& content_type,
+ const ResourceIdentifier& resource_identifier,
+ Rules* content_setting_rules) const = 0;
+
+ // 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_
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698