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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
14 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "content/public/browser/host_zoom_map.h" | 16 #include "content/public/browser/host_zoom_map.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 | 19 |
| 20 namespace base { |
| 21 class DictionaryValue; |
| 22 } |
| 23 |
20 namespace content { | 24 namespace content { |
21 | 25 |
22 class WebContentsImpl; | 26 class WebContentsImpl; |
23 | 27 |
24 // 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 |
25 // to notifications on there (and holds a NotificationRegistrar). | 29 // to notifications on there (and holds a NotificationRegistrar). |
26 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), | 30 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
27 public NotificationObserver, | 31 public NotificationObserver { |
28 public base::SupportsUserData::Data { | |
29 public: | 32 public: |
30 HostZoomMapImpl(); | 33 HostZoomMapImpl(); |
31 virtual ~HostZoomMapImpl(); | 34 virtual ~HostZoomMapImpl(); |
32 | 35 |
33 // HostZoomMap implementation: | 36 // HostZoomMap implementation: |
34 virtual void CopyFrom(HostZoomMap* copy) OVERRIDE; | 37 virtual void CopyFrom(HostZoomMap* copy) OVERRIDE; |
35 virtual double GetZoomLevelForHostAndScheme( | 38 virtual double GetZoomLevelForHostAndScheme( |
36 const std::string& scheme, | 39 const std::string& scheme, |
37 const std::string& host) const OVERRIDE; | 40 const std::string& host) const OVERRIDE; |
38 // TODO(wjmaclean) Should we use a GURL here? crbug.com/384486 | 41 // TODO(wjmaclean) Should we use a GURL here? crbug.com/384486 |
(...skipping 13 matching lines...) Expand all Loading... |
52 int render_view_id, | 55 int render_view_id, |
53 double level) OVERRIDE; | 56 double level) OVERRIDE; |
54 | 57 |
55 virtual void ClearTemporaryZoomLevel(int render_process_id, | 58 virtual void ClearTemporaryZoomLevel(int render_process_id, |
56 int render_view_id) OVERRIDE; | 59 int render_view_id) OVERRIDE; |
57 virtual double GetDefaultZoomLevel() const OVERRIDE; | 60 virtual double GetDefaultZoomLevel() const OVERRIDE; |
58 virtual void SetDefaultZoomLevel(double level) OVERRIDE; | 61 virtual void SetDefaultZoomLevel(double level) OVERRIDE; |
59 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 62 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
60 const ZoomLevelChangedCallback& callback) OVERRIDE; | 63 const ZoomLevelChangedCallback& callback) OVERRIDE; |
61 | 64 |
| 65 // Returns a dictionary of ZoomLevels. Schemes are stripped away, but |
| 66 // scheme+host zoom levels are included. |
| 67 scoped_ptr<base::DictionaryValue> GetZoomLevelDictionary() const; |
| 68 |
62 // Returns the current zoom level for the specified WebContents. This may | 69 // Returns the current zoom level for the specified WebContents. This may |
63 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). | 70 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). |
64 double GetZoomLevelForWebContents( | 71 double GetZoomLevelForWebContents( |
65 const WebContentsImpl& web_contents_impl) const; | 72 const WebContentsImpl& web_contents_impl) const; |
66 | 73 |
67 // Sets the zoom level for this WebContents. If this WebContents is using | 74 // 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. | 75 // a temporary zoom level, then level is only applied to this WebContents. |
69 // Otherwise, the level will be applied on a host level. | 76 // Otherwise, the level will be applied on a host level. |
70 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, | 77 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, |
71 double level); | 78 double level); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 mutable base::Lock lock_; | 143 mutable base::Lock lock_; |
137 | 144 |
138 NotificationRegistrar registrar_; | 145 NotificationRegistrar registrar_; |
139 | 146 |
140 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 147 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
141 }; | 148 }; |
142 | 149 |
143 } // namespace content | 150 } // namespace content |
144 | 151 |
145 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 152 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
OLD | NEW |