diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 04:25:31 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 04:25:31 +0000 |
commit | 3ef4bc6355b48c74928feefd8bbaff501bb8d59f (patch) | |
tree | 7f0fc3af5589ec28f7347ebbfcc598d8b475885a /chrome/browser/host_zoom_map.h | |
parent | 3347bab3eed62551354d0d49c5f1f185244a9bb1 (diff) | |
download | chromium_src-3ef4bc6355b48c74928feefd8bbaff501bb8d59f.zip chromium_src-3ef4bc6355b48c74928feefd8bbaff501bb8d59f.tar.gz chromium_src-3ef4bc6355b48c74928feefd8bbaff501bb8d59f.tar.bz2 |
Make HostZoomMap play nicely with preference sync.
Review URL: http://codereview.chromium.org/1560023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_zoom_map.h')
-rw-r--r-- | chrome/browser/host_zoom_map.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/browser/host_zoom_map.h b/chrome/browser/host_zoom_map.h index f64ca6b..87dee2c 100644 --- a/chrome/browser/host_zoom_map.h +++ b/chrome/browser/host_zoom_map.h @@ -14,11 +14,14 @@ #include "base/basictypes.h" #include "base/lock.h" #include "base/ref_counted.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" class PrefService; class Profile; -class HostZoomMap : public base::RefCountedThreadSafe<HostZoomMap> { +class HostZoomMap : public NotificationObserver, + public base::RefCountedThreadSafe<HostZoomMap> { public: explicit HostZoomMap(Profile* profile); @@ -43,6 +46,11 @@ class HostZoomMap : public base::RefCountedThreadSafe<HostZoomMap> { // 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<HostZoomMap>; @@ -50,6 +58,13 @@ class HostZoomMap : public base::RefCountedThreadSafe<HostZoomMap> { ~HostZoomMap(); + // Reads the zoom levels from the preferences service. + void Load(); + + // Removes dependencies on the profile so we can live longer than + // the profile without crashing. + void Shutdown(); + // The profile we're associated with. Profile* profile_; @@ -59,6 +74,12 @@ class HostZoomMap : public base::RefCountedThreadSafe<HostZoomMap> { // Used around accesses to |host_zoom_levels_| to guarantee thread safety. mutable Lock lock_; + // Whether we are currently updating preferences, this is used to ignore + // notifications from the preference service that we triggered ourself. + bool updating_preferences_; + + NotificationRegistrar registrar_; + DISALLOW_COPY_AND_ASSIGN(HostZoomMap); }; |