Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: content/browser/host_zoom_map.h

Issue 7800015: prune down content_dll change to just the CONTENT_EXPORTS (Closed)
Patch Set: fix exports for switches, content_main Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/browser_thread.h" 19 #include "content/browser/browser_thread.h"
20 #include "content/common/content_export.h"
20 #include "content/common/notification_observer.h" 21 #include "content/common/notification_observer.h"
21 #include "content/common/notification_registrar.h" 22 #include "content/common/notification_registrar.h"
22 23
23 class GURL; 24 class GURL;
24 25
25 // HostZoomMap needs to be deleted on the UI thread because it listens 26 // HostZoomMap needs to be deleted on the UI thread because it listens
26 // to notifications on there (and holds a NotificationRegistrar). 27 // to notifications on there (and holds a NotificationRegistrar).
27 class HostZoomMap : 28 class CONTENT_EXPORT HostZoomMap
28 public NotificationObserver, 29 : public NotificationObserver,
29 public base::RefCountedThreadSafe<HostZoomMap, 30 public base::RefCountedThreadSafe<HostZoomMap,
30 BrowserThread::DeleteOnUIThread> { 31 BrowserThread::DeleteOnUIThread> {
31 public: 32 public:
32 HostZoomMap(); 33 HostZoomMap();
33 34
34 // Returns the zoom level for the host or spec for a given url. The zoom 35 // Returns the zoom level for the host or spec for a given url. The zoom
35 // level is determined by the host portion of the URL, or (in the absence of 36 // level is determined by the host portion of the URL, or (in the absence of
36 // a host) the complete spec of the URL. In most cases, there is no custom 37 // a host) the complete spec of the URL. In most cases, there is no custom
37 // zoom level, and this returns the user's default zoom level. Otherwise, 38 // zoom level, and this returns the user's default zoom level. Otherwise,
38 // returns the saved zoom level, which may be positive (to zoom in) or 39 // returns the saved zoom level, which may be positive (to zoom in) or
39 // negative (to zoom out). 40 // negative (to zoom out).
40 // 41 //
(...skipping 25 matching lines...) Expand all
66 67
67 // NotificationObserver implementation. 68 // NotificationObserver implementation.
68 virtual void Observe(int type, 69 virtual void Observe(int type,
69 const NotificationSource& source, 70 const NotificationSource& source,
70 const NotificationDetails& details); 71 const NotificationDetails& details);
71 72
72 double default_zoom_level() const { return default_zoom_level_; } 73 double default_zoom_level() const { return default_zoom_level_; }
73 void set_default_zoom_level(double level) { default_zoom_level_ = level; } 74 void set_default_zoom_level(double level) { default_zoom_level_ = level; }
74 75
75 private: 76 private:
77 friend base::RefCountedThreadSafe<HostZoomMap,
78 BrowserThread::DeleteOnUIThread>;
76 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 79 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
77 friend class DeleteTask<HostZoomMap>; 80 friend class DeleteTask<HostZoomMap>;
78 81
79 typedef std::map<std::string, double> HostZoomLevels; 82 typedef std::map<std::string, double> HostZoomLevels;
80 83
81 virtual ~HostZoomMap(); 84 virtual ~HostZoomMap();
82 85
83 // Copy of the pref data, so that we can read it on the IO thread. 86 // Copy of the pref data, so that we can read it on the IO thread.
84 HostZoomLevels host_zoom_levels_; 87 HostZoomLevels host_zoom_levels_;
85 double default_zoom_level_; 88 double default_zoom_level_;
(...skipping 11 matching lines...) Expand all
97 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and 100 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
98 // |temporary_zoom_levels_| to guarantee thread safety. 101 // |temporary_zoom_levels_| to guarantee thread safety.
99 mutable base::Lock lock_; 102 mutable base::Lock lock_;
100 103
101 NotificationRegistrar registrar_; 104 NotificationRegistrar registrar_;
102 105
103 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); 106 DISALLOW_COPY_AND_ASSIGN(HostZoomMap);
104 }; 107 };
105 108
106 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ 109 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698