OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 // 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 |
25 // to notifications on there (and holds a NotificationRegistrar). | 25 // to notifications on there (and holds a NotificationRegistrar). |
26 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), | 26 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
27 public NotificationObserver, | 27 public NotificationObserver, |
28 public base::SupportsUserData::Data { | 28 public base::SupportsUserData::Data { |
29 public: | 29 public: |
30 HostZoomMapImpl(); | 30 HostZoomMapImpl(); |
31 virtual ~HostZoomMapImpl(); | 31 virtual ~HostZoomMapImpl(); |
32 | 32 |
33 // HostZoomMap implementation: | 33 // HostZoomMap implementation: |
34 virtual void CopyFrom(HostZoomMap* copy) OVERRIDE; | 34 virtual void CopyFrom(HostZoomMap* copy) override; |
35 virtual double GetZoomLevelForHostAndScheme( | 35 virtual double GetZoomLevelForHostAndScheme( |
36 const std::string& scheme, | 36 const std::string& scheme, |
37 const std::string& host) const OVERRIDE; | 37 const std::string& host) const override; |
38 // TODO(wjmaclean) Should we use a GURL here? crbug.com/384486 | 38 // TODO(wjmaclean) Should we use a GURL here? crbug.com/384486 |
39 virtual bool HasZoomLevel(const std::string& scheme, | 39 virtual bool HasZoomLevel(const std::string& scheme, |
40 const std::string& host) const OVERRIDE; | 40 const std::string& host) const override; |
41 virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE; | 41 virtual ZoomLevelVector GetAllZoomLevels() const override; |
42 virtual void SetZoomLevelForHost( | 42 virtual void SetZoomLevelForHost( |
43 const std::string& host, | 43 const std::string& host, |
44 double level) OVERRIDE; | 44 double level) override; |
45 virtual void SetZoomLevelForHostAndScheme( | 45 virtual void SetZoomLevelForHostAndScheme( |
46 const std::string& scheme, | 46 const std::string& scheme, |
47 const std::string& host, | 47 const std::string& host, |
48 double level) OVERRIDE; | 48 double level) override; |
49 virtual bool UsesTemporaryZoomLevel(int render_process_id, | 49 virtual bool UsesTemporaryZoomLevel(int render_process_id, |
50 int render_view_id) const OVERRIDE; | 50 int render_view_id) const override; |
51 virtual void SetTemporaryZoomLevel(int render_process_id, | 51 virtual void SetTemporaryZoomLevel(int render_process_id, |
52 int render_view_id, | 52 int render_view_id, |
53 double level) OVERRIDE; | 53 double level) override; |
54 | 54 |
55 virtual void ClearTemporaryZoomLevel(int render_process_id, | 55 virtual void ClearTemporaryZoomLevel(int render_process_id, |
56 int render_view_id) OVERRIDE; | 56 int render_view_id) override; |
57 virtual double GetDefaultZoomLevel() const OVERRIDE; | 57 virtual double GetDefaultZoomLevel() const override; |
58 virtual void SetDefaultZoomLevel(double level) OVERRIDE; | 58 virtual void SetDefaultZoomLevel(double level) override; |
59 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 59 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
60 const ZoomLevelChangedCallback& callback) OVERRIDE; | 60 const ZoomLevelChangedCallback& callback) override; |
61 | 61 |
62 // Returns the current zoom level for the specified WebContents. This may | 62 // Returns the current zoom level for the specified WebContents. This may |
63 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). | 63 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). |
64 double GetZoomLevelForWebContents( | 64 double GetZoomLevelForWebContents( |
65 const WebContentsImpl& web_contents_impl) const; | 65 const WebContentsImpl& web_contents_impl) const; |
66 | 66 |
67 // Sets the zoom level for this WebContents. If this WebContents is using | 67 // Sets the zoom level for this WebContents. If this WebContents is using |
68 // a temporary zoom level, then level is only applied to this WebContents. | 68 // a temporary zoom level, then level is only applied to this WebContents. |
69 // Otherwise, the level will be applied on a host level. | 69 // Otherwise, the level will be applied on a host level. |
70 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, | 70 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, |
(...skipping 10 matching lines...) Expand all Loading... |
81 // the given WebContents (i.e. isn't saved and doesn't affect other | 81 // the given WebContents (i.e. isn't saved and doesn't affect other |
82 // WebContentses) if it exists, the default zoom level otherwise. | 82 // WebContentses) if it exists, the default zoom level otherwise. |
83 // | 83 // |
84 // This may be called on any thread. | 84 // This may be called on any thread. |
85 double GetTemporaryZoomLevel(int render_process_id, | 85 double GetTemporaryZoomLevel(int render_process_id, |
86 int render_view_id) const; | 86 int render_view_id) const; |
87 | 87 |
88 // NotificationObserver implementation. | 88 // NotificationObserver implementation. |
89 virtual void Observe(int type, | 89 virtual void Observe(int type, |
90 const NotificationSource& source, | 90 const NotificationSource& source, |
91 const NotificationDetails& details) OVERRIDE; | 91 const NotificationDetails& details) override; |
92 | 92 |
93 private: | 93 private: |
94 typedef std::map<std::string, double> HostZoomLevels; | 94 typedef std::map<std::string, double> HostZoomLevels; |
95 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; | 95 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; |
96 | 96 |
97 struct RenderViewKey { | 97 struct RenderViewKey { |
98 int render_process_id; | 98 int render_process_id; |
99 int render_view_id; | 99 int render_view_id; |
100 RenderViewKey(int render_process_id, int render_view_id) | 100 RenderViewKey(int render_process_id, int render_view_id) |
101 : render_process_id(render_process_id), | 101 : render_process_id(render_process_id), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 mutable base::Lock lock_; | 136 mutable base::Lock lock_; |
137 | 137 |
138 NotificationRegistrar registrar_; | 138 NotificationRegistrar registrar_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 140 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
144 | 144 |
145 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 145 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
OLD | NEW |