summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_zoom_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/host_zoom_map.h')
-rw-r--r--chrome/browser/host_zoom_map.h23
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);
};