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

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

Issue 6484035: Add a content_settings::BaseProvider for code that is shared by all content settings providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 10 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/pref_content_settings_provider.h
diff --git a/chrome/browser/content_settings/pref_content_settings_provider.h b/chrome/browser/content_settings/pref_content_settings_provider.h
index b4631b8d9e79017beb2d5f79e2a8a5370068ab6e..098182c5de00dbbdf526f31e5ba15fb75b45def6 100644
--- a/chrome/browser/content_settings/pref_content_settings_provider.h
+++ b/chrome/browser/content_settings/pref_content_settings_provider.h
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/synchronization/lock.h"
+#include "chrome/browser/content_settings/content_settings_base_provider.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/common/notification_observer.h"
@@ -90,7 +91,9 @@ class PrefDefaultProvider : public DefaultProviderInterface,
DISALLOW_COPY_AND_ASSIGN(PrefDefaultProvider);
};
-class PrefProvider : public ProviderInterface,
+// Content settings provider that provides content settings from the user
+// preference.
+class PrefProvider : public BaseProvider,
public NotificationObserver {
public:
static void RegisterUserPrefs(PrefService* prefs);
@@ -102,12 +105,6 @@ class PrefProvider : public ProviderInterface,
virtual bool ContentSettingsTypeIsManaged(
ContentSettingsType content_type);
- virtual ContentSetting GetContentSetting(
- const GURL& requesting_url,
- const GURL& embedding_url,
- ContentSettingsType content_type,
- const ResourceIdentifier& resource_identifier) const;
-
virtual void SetContentSetting(
const ContentSettingsPattern& requesting_pattern,
const ContentSettingsPattern& embedding_pattern,
@@ -115,43 +112,27 @@ class PrefProvider : public ProviderInterface,
const ResourceIdentifier& resource_identifier,
ContentSetting content_setting);
- virtual void GetAllContentSettingsRules(
- ContentSettingsType content_type,
- const ResourceIdentifier& resource_identifier,
- Rules* content_setting_rules) const;
-
virtual void ClearAllContentSettingsRules(
ContentSettingsType content_type);
virtual void ResetToDefaults();
+ // BaseProvider implementations.
+ virtual void Init();
+
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
private:
- typedef std::pair<ContentSettingsType, std::string>
- ContentSettingsTypeResourceIdentifierPair;
- typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting>
- ResourceContentSettings;
-
- struct ExtendedContentSettings;
-
- typedef std::map<std::string, ExtendedContentSettings> HostContentSettings;
+ void ReadExceptions(bool overwrite);
// Various migration methods (old cookie, popup and per-host data gets
// migrated to the new format).
void MigrateObsoletePerhostPref(PrefService* prefs);
void MigrateObsoletePopupsPref(PrefService* prefs);
- bool AllDefault(const ExtendedContentSettings& settings) const;
-
- void ReadExceptions(bool overwrite);
-
- bool RequiresResourceIdentifier(
- ContentSettingsType content_type) const;
-
void CanonicalizeContentSettingsExceptions(
DictionaryValue* all_settings_dictionary);
@@ -169,24 +150,9 @@ class PrefProvider : public ProviderInterface,
Profile* profile_;
- // Whether this settings map is for an OTR session.
- bool is_off_the_record_;
-
- // Used around accesses to the content_settings_ object to guarantee
- // thread safety.
- mutable base::Lock lock_;
-
PrefChangeRegistrar pref_change_registrar_;
NotificationRegistrar notification_registrar_;
- // Copies of the pref data, so that we can read it on threads other than the
- // UI thread.
- HostContentSettings host_content_settings_;
-
- // Differences to the preference-stored host content settings for
- // off-the-record settings.
- HostContentSettings off_the_record_settings_;
-
// Whether we are currently updating preferences, this is used to ignore
// notifications from the preferences service that we triggered ourself.
bool updating_preferences_;
@@ -194,9 +160,6 @@ class PrefProvider : public ProviderInterface,
// Do not fire any Notifications as long as we are in the constructor.
bool initializing_;
- // LEGACY: TBR
- ContentSettings GetNonDefaultContentSettings(const GURL& url) const;
-
DISALLOW_COPY_AND_ASSIGN(PrefProvider);
};

Powered by Google App Engine
This is Rietveld 408576698