diff options
author | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 22:45:28 +0000 |
---|---|---|
committer | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 22:45:28 +0000 |
commit | 8efe880f7e32968be75022b549adb28ee785c82a (patch) | |
tree | e8d660611c916662646e6957bdbc9e26d3fe6d61 /chrome/browser/host_content_settings_map.h | |
parent | 22e9fcb4b0953dff041ab134346ced0ebf30712f (diff) | |
download | chromium_src-8efe880f7e32968be75022b549adb28ee785c82a.zip chromium_src-8efe880f7e32968be75022b549adb28ee785c82a.tar.gz chromium_src-8efe880f7e32968be75022b549adb28ee785c82a.tar.bz2 |
Use ScopedPrefUpdate to correctly send out notifications when the host
content settnigs are update.
BUG=none
TEST=HostContentSettingsMapTest
Review URL: http://codereview.chromium.org/1606016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_content_settings_map.h')
-rw-r--r-- | chrome/browser/host_content_settings_map.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/host_content_settings_map.h b/chrome/browser/host_content_settings_map.h index 4b4e141..59509ef 100644 --- a/chrome/browser/host_content_settings_map.h +++ b/chrome/browser/host_content_settings_map.h @@ -17,6 +17,7 @@ #include "base/lock.h" #include "base/ref_counted.h" #include "chrome/common/content_settings.h" +#include "chrome/common/notification_observer.h" #include "googleurl/src/gurl.h" class DictionaryValue; @@ -24,7 +25,8 @@ class PrefService; class Profile; class HostContentSettingsMap - : public base::RefCountedThreadSafe<HostContentSettingsMap> { + : public NotificationObserver, + public base::RefCountedThreadSafe<HostContentSettingsMap> { public: // Details for the CONTENT_SETTINGS_CHANGED notification. This is sent when // content settings change for at least one host. If settings change for more @@ -116,6 +118,11 @@ class HostContentSettingsMap // This should only be called on the UI thread. void ResetToDefaults(); + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + private: friend class base::RefCountedThreadSafe<HostContentSettingsMap>; @@ -129,6 +136,14 @@ class HostContentSettingsMap ~HostContentSettingsMap(); + // Reads the default settings from the prefereces service. If |overwrite| is + // true and the preference is missing, the local copy will be cleared as well. + void ReadDefaultSettings(bool overwrite); + + // Reads the host settings from the prefereces service. If |overwrite| is true + // and the preference is missing, the local copy will be cleared as well. + void ReadPerHostSettings(bool overwrite); + // Returns true if we should allow all content types for this URL. This is // true for various internal objects like chrome:// URLs, so UI and other // things users think of as "not webpages" don't break. @@ -164,6 +179,10 @@ class HostContentSettingsMap // Used around accesses to the settings objects to guarantee thread safety. mutable Lock lock_; + // Whether we are currently updating preferences, this is used to ignore + // notifications from the preferences service that we triggered ourself. + bool updating_settings_; + DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); }; |