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 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/lock.h" | |
18 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 18 #include "base/synchronization/lock.h" |
19 #include "chrome/browser/browser_thread.h" | 19 #include "chrome/browser/browser_thread.h" |
20 #include "chrome/browser/prefs/pref_change_registrar.h" | 20 #include "chrome/browser/prefs/pref_change_registrar.h" |
21 #include "chrome/common/notification_observer.h" | 21 #include "chrome/common/notification_observer.h" |
22 #include "chrome/common/notification_registrar.h" | 22 #include "chrome/common/notification_registrar.h" |
23 | 23 |
24 class GURL; | 24 class GURL; |
25 class PrefService; | 25 class PrefService; |
26 class Profile; | 26 class Profile; |
27 | 27 |
28 // HostZoomMap needs to be deleted on the UI thread because it listens | 28 // HostZoomMap needs to be deleted on the UI thread because it listens |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int render_view_id; | 105 int render_view_id; |
106 double zoom_level; | 106 double zoom_level; |
107 }; | 107 }; |
108 | 108 |
109 // Don't expect more than a couple of tabs that are using a temporary zoom | 109 // Don't expect more than a couple of tabs that are using a temporary zoom |
110 // level, so vector is fine for now. | 110 // level, so vector is fine for now. |
111 std::vector<TemporaryZoomLevel> temporary_zoom_levels_; | 111 std::vector<TemporaryZoomLevel> temporary_zoom_levels_; |
112 | 112 |
113 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and | 113 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and |
114 // |temporary_zoom_levels_| to guarantee thread safety. | 114 // |temporary_zoom_levels_| to guarantee thread safety. |
115 mutable Lock lock_; | 115 mutable base::Lock lock_; |
116 | 116 |
117 // Whether we are currently updating preferences, this is used to ignore | 117 // Whether we are currently updating preferences, this is used to ignore |
118 // notifications from the preference service that we triggered ourself. | 118 // notifications from the preference service that we triggered ourself. |
119 bool updating_preferences_; | 119 bool updating_preferences_; |
120 | 120 |
121 NotificationRegistrar registrar_; | 121 NotificationRegistrar registrar_; |
122 PrefChangeRegistrar pref_change_registrar_; | 122 PrefChangeRegistrar pref_change_registrar_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); | 124 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); |
125 }; | 125 }; |
126 | 126 |
127 #endif // CHROME_BROWSER_HOST_ZOOM_MAP_H_ | 127 #endif // CHROME_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |