OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Maps hostnames to custom zoom levels. Written on the UI thread and read on | 5 // Maps hostnames to custom zoom levels. Written on the UI thread and read on |
6 // any thread. One instance per profile. | 6 // any thread. One instance per profile. |
7 | 7 |
8 #ifndef CHROME_BROWSER_HOST_ZOOM_MAP_H_ | 8 #ifndef CHROME_BROWSER_HOST_ZOOM_MAP_H_ |
9 #define CHROME_BROWSER_HOST_ZOOM_MAP_H_ | 9 #define CHROME_BROWSER_HOST_ZOOM_MAP_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/lock.h" | 16 #include "base/lock.h" |
17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 18 #include "chrome/browser/prefs/pref_change_registrar.h" |
18 #include "chrome/common/notification_observer.h" | 19 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
20 | 21 |
21 class GURL; | 22 class GURL; |
22 class PrefService; | 23 class PrefService; |
23 class Profile; | 24 class Profile; |
24 | 25 |
25 class HostZoomMap : public NotificationObserver, | 26 class HostZoomMap : public NotificationObserver, |
26 public base::RefCountedThreadSafe<HostZoomMap> { | 27 public base::RefCountedThreadSafe<HostZoomMap> { |
27 public: | 28 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 HostZoomLevels host_zoom_levels_; | 77 HostZoomLevels host_zoom_levels_; |
77 | 78 |
78 // Used around accesses to |host_zoom_levels_| to guarantee thread safety. | 79 // Used around accesses to |host_zoom_levels_| to guarantee thread safety. |
79 mutable Lock lock_; | 80 mutable Lock lock_; |
80 | 81 |
81 // Whether we are currently updating preferences, this is used to ignore | 82 // Whether we are currently updating preferences, this is used to ignore |
82 // notifications from the preference service that we triggered ourself. | 83 // notifications from the preference service that we triggered ourself. |
83 bool updating_preferences_; | 84 bool updating_preferences_; |
84 | 85 |
85 NotificationRegistrar registrar_; | 86 NotificationRegistrar registrar_; |
| 87 PrefChangeRegistrar pref_change_registrar_; |
86 | 88 |
87 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); | 89 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); |
88 }; | 90 }; |
89 | 91 |
90 #endif // CHROME_BROWSER_HOST_ZOOM_MAP_H_ | 92 #endif // CHROME_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |