Chromium Code Reviews| Index: content/browser/host_zoom_map_impl.h |
| diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h |
| index 155f18e00fb2babd091a352d5df7b2b6974982ce..e8a901e823dd175b4777fe0b169afed2f49cab11 100644 |
| --- a/content/browser/host_zoom_map_impl.h |
| +++ b/content/browser/host_zoom_map_impl.h |
| @@ -19,6 +19,8 @@ |
| namespace content { |
| +class WebContentsImpl; |
| + |
| // HostZoomMap needs to be deleted on the UI thread because it listens |
| // to notifications on there (and holds a NotificationRegistrar). |
| class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
| @@ -46,6 +48,35 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
| virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
| const ZoomLevelChangedCallback& callback) OVERRIDE; |
| + // Returns the current zoom level for the specified WebContents. This may |
| + // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). |
| + double GetZoomLevelForWebContents( |
| + const WebContentsImpl& web_contents_impl) const; |
| + |
| + // Sets the zoom level for this WebContents. If this WebContents is using |
| + // a temporary zoom level, then level is only applied to this WebContents. |
| + // Otherwise, the level will be applied on a host level. |
| + void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, |
| + double level); |
| + |
| + // Sets the zoom level for the specified view. The level may be set for only |
| + // this view, or for the host, depending on UsesTemporaryZoomLevel(). |
| + void SetZoomLevelForView(int render_process_id, |
| + int render_view_id, |
| + double level, |
| + const std::string& host); |
| + |
| + // Returns whether the view manages its zoom level independently of other tabs |
| + // displaying content from the same host. |
| + bool UsesTemporaryZoomLevel(int render_process_id, int render_view_id) const; |
| + |
| + // Sets whether the view manages its zoom level independently of other tabs |
| + // displaying content from the same host, based on whether |
| + // |uses_temporary_zoom_level| is true. |
| + void SetUsesTemporaryZoomLevel(int render_process_id, |
| + int render_view_id, |
| + bool uses_temporary_zoom_level); |
| + |
| // Returns the temporary zoom level that's only valid for the lifetime of |
| // the given WebContents (i.e. isn't saved and doesn't affect other |
| // WebContentses) if it exists, the default zoom level otherwise. |
| @@ -83,6 +114,10 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
| double default_zoom_level_; |
| struct TemporaryZoomLevel { |
| + TemporaryZoomLevel(int process_id, int view_id, double level); |
| + TemporaryZoomLevel(int process_id, int view_id); |
| + bool operator==(const TemporaryZoomLevel& other) const; |
| + |
| int render_process_id; |
| int render_view_id; |
| double zoom_level; |
| @@ -90,7 +125,8 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), |
| // Don't expect more than a couple of tabs that are using a temporary zoom |
| // level, so vector is fine for now. |
| - std::vector<TemporaryZoomLevel> temporary_zoom_levels_; |
| + typedef std::vector<TemporaryZoomLevel> TemporaryZoomLevels; |
|
Peter Kasting
2014/05/29 18:16:08
Nit: Style guide says typedefs and enums go at the
wjmaclean
2014/05/29 20:14:19
Done.
|
| + TemporaryZoomLevels temporary_zoom_levels_; |
| // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and |
| // |temporary_zoom_levels_| to guarantee thread safety. |