OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 browser context. | 6 // any thread. One instance per browser context. |
7 | 7 |
8 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 8 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_H_ |
9 #define CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 9 #define CONTENT_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/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
23 | 23 |
24 class GURL; | |
25 | |
26 // HostZoomMap needs to be deleted on the UI thread because it listens | 24 // HostZoomMap needs to be deleted on the UI thread because it listens |
27 // to notifications on there (and holds a NotificationRegistrar). | 25 // to notifications on there (and holds a NotificationRegistrar). |
28 class CONTENT_EXPORT HostZoomMap | 26 class CONTENT_EXPORT HostZoomMap |
29 : public content::NotificationObserver, | 27 : public content::NotificationObserver, |
30 public base::RefCountedThreadSafe< | 28 public base::RefCountedThreadSafe< |
31 HostZoomMap, content::BrowserThread::DeleteOnUIThread> { | 29 HostZoomMap, content::BrowserThread::DeleteOnUIThread> { |
32 public: | 30 public: |
33 explicit HostZoomMap(); | 31 explicit HostZoomMap(); |
34 explicit HostZoomMap(HostZoomMap* original); | 32 explicit HostZoomMap(HostZoomMap* original); |
35 | 33 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and | 106 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and |
109 // |temporary_zoom_levels_| to guarantee thread safety. | 107 // |temporary_zoom_levels_| to guarantee thread safety. |
110 mutable base::Lock lock_; | 108 mutable base::Lock lock_; |
111 | 109 |
112 content::NotificationRegistrar registrar_; | 110 content::NotificationRegistrar registrar_; |
113 | 111 |
114 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); | 112 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); |
115 }; | 113 }; |
116 | 114 |
117 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 115 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |