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

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

Issue 8437002: Move BrowserThread to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few updates. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.cc ('k') | content/browser/host_zoom_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 13 matching lines...) Expand all
24 namespace base { 24 namespace base {
25 class DictionaryValue; 25 class DictionaryValue;
26 } 26 }
27 27
28 class GURL; 28 class GURL;
29 29
30 // HostZoomMap needs to be deleted on the UI thread because it listens 30 // HostZoomMap needs to be deleted on the UI thread because it listens
31 // to notifications on there (and holds a NotificationRegistrar). 31 // to notifications on there (and holds a NotificationRegistrar).
32 class CONTENT_EXPORT HostZoomMap 32 class CONTENT_EXPORT HostZoomMap
33 : public content::NotificationObserver, 33 : public content::NotificationObserver,
34 public base::RefCountedThreadSafe<HostZoomMap, 34 public base::RefCountedThreadSafe<
35 BrowserThread::DeleteOnUIThread> { 35 HostZoomMap, content::BrowserThread::DeleteOnUIThread> {
36 public: 36 public:
37 explicit HostZoomMap(); 37 explicit HostZoomMap();
38 explicit HostZoomMap(HostZoomMap* original); 38 explicit HostZoomMap(HostZoomMap* original);
39 39
40 // Returns the zoom level for the host or spec for a given url. The zoom 40 // Returns the zoom level for the host or spec for a given url. The zoom
41 // level is determined by the host portion of the URL, or (in the absence of 41 // level is determined by the host portion of the URL, or (in the absence of
42 // a host) the complete spec of the URL. In most cases, there is no custom 42 // a host) the complete spec of the URL. In most cases, there is no custom
43 // zoom level, and this returns the user's default zoom level. Otherwise, 43 // zoom level, and this returns the user's default zoom level. Otherwise,
44 // returns the saved zoom level, which may be positive (to zoom in) or 44 // returns the saved zoom level, which may be positive (to zoom in) or
45 // negative (to zoom out). 45 // negative (to zoom out).
(...skipping 28 matching lines...) Expand all
74 virtual void Observe(int type, 74 virtual void Observe(int type,
75 const content::NotificationSource& source, 75 const content::NotificationSource& source,
76 const content::NotificationDetails& details); 76 const content::NotificationDetails& details);
77 77
78 double default_zoom_level() const { return default_zoom_level_; } 78 double default_zoom_level() const { return default_zoom_level_; }
79 void set_default_zoom_level(double level) { default_zoom_level_ = level; } 79 void set_default_zoom_level(double level) { default_zoom_level_ = level; }
80 80
81 HostZoomMap* GetOriginal() const { return original_; } 81 HostZoomMap* GetOriginal() const { return original_; }
82 82
83 private: 83 private:
84 friend class base::RefCountedThreadSafe<HostZoomMap, 84 friend class base::RefCountedThreadSafe<
85 BrowserThread::DeleteOnUIThread>; 85 HostZoomMap, content::BrowserThread::DeleteOnUIThread>;
86 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 86 friend struct content::BrowserThread::DeleteOnThread<
87 content::BrowserThread::UI>;
87 friend class DeleteTask<HostZoomMap>; 88 friend class DeleteTask<HostZoomMap>;
88 89
89 typedef std::map<std::string, double> HostZoomLevels; 90 typedef std::map<std::string, double> HostZoomLevels;
90 91
91 virtual ~HostZoomMap(); 92 virtual ~HostZoomMap();
92 void Init(); 93 void Init();
93 94
94 // Copy of the pref data, so that we can read it on the IO thread. 95 // Copy of the pref data, so that we can read it on the IO thread.
95 HostZoomLevels host_zoom_levels_; 96 HostZoomLevels host_zoom_levels_;
96 double default_zoom_level_; 97 double default_zoom_level_;
(...skipping 14 matching lines...) Expand all
111 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and 112 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
112 // |temporary_zoom_levels_| to guarantee thread safety. 113 // |temporary_zoom_levels_| to guarantee thread safety.
113 mutable base::Lock lock_; 114 mutable base::Lock lock_;
114 115
115 content::NotificationRegistrar registrar_; 116 content::NotificationRegistrar registrar_;
116 117
117 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); 118 DISALLOW_COPY_AND_ASSIGN(HostZoomMap);
118 }; 119 };
119 120
120 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ 121 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.cc ('k') | content/browser/host_zoom_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698