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_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
6 #define CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 6 #define CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Here |host| is the host portion of URL, or (in the absence of a host) | 71 // Here |host| is the host portion of URL, or (in the absence of a host) |
72 // the complete spec of the URL. | 72 // the complete spec of the URL. |
73 // Returns the zoom for the specified |scheme| and |host|. See class | 73 // Returns the zoom for the specified |scheme| and |host|. See class |
74 // description for details. | 74 // description for details. |
75 // | 75 // |
76 // This may be called on any thread. | 76 // This may be called on any thread. |
77 virtual double GetZoomLevelForHostAndScheme( | 77 virtual double GetZoomLevelForHostAndScheme( |
78 const std::string& scheme, | 78 const std::string& scheme, |
79 const std::string& host) const = 0; | 79 const std::string& host) const = 0; |
80 | 80 |
81 // Returns all non-temporary zoom levels. Can only be called on any thread. | 81 // Returns true if the specified |scheme| and/or |host| has a zoom level |
| 82 // currently set. |
| 83 // |
| 84 // This may be called on any thread. |
| 85 virtual bool HasZoomLevel(const std::string& scheme, |
| 86 const std::string& host) const = 0; |
| 87 |
| 88 // Returns all non-temporary zoom levels. Can be called on any thread. |
82 virtual ZoomLevelVector GetAllZoomLevels() const = 0; | 89 virtual ZoomLevelVector GetAllZoomLevels() const = 0; |
83 | 90 |
84 // Here |host| is the host portion of URL, or (in the absence of a host) | 91 // Here |host| is the host portion of URL, or (in the absence of a host) |
85 // the complete spec of the URL. | 92 // the complete spec of the URL. |
86 // Sets the zoom level for the |host| to |level|. If the level matches the | 93 // Sets the zoom level for the |host| to |level|. If the level matches the |
87 // current default zoom level, the host is erased from the saved preferences; | 94 // current default zoom level, the host is erased from the saved preferences; |
88 // otherwise the new value is written out. | 95 // otherwise the new value is written out. |
89 // Zoom levels specified for both scheme and host are not affected. | 96 // Zoom levels specified for both scheme and host are not affected. |
90 // | 97 // |
91 // This should only be called on the UI thread. | 98 // This should only be called on the UI thread. |
92 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; | 99 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; |
93 | 100 |
94 // Here |host| is the host portion of URL, or (in the absence of a host) | 101 // Here |host| is the host portion of URL, or (in the absence of a host) |
95 // the complete spec of the URL. | 102 // the complete spec of the URL. |
96 // Sets the zoom level for the |scheme|/|host| pair to |level|. No values | 103 // Sets the zoom level for the |scheme|/|host| pair to |level|. No values |
97 // will be erased during this operation, and this value will not be stored in | 104 // will be erased during this operation, and this value will not be stored in |
98 // the preferences. | 105 // the preferences. |
99 // | 106 // |
100 // This should only be called on the UI thread. | 107 // This should only be called on the UI thread. |
101 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, | 108 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, |
102 const std::string& host, | 109 const std::string& host, |
103 double level) = 0; | 110 double level) = 0; |
104 | 111 |
| 112 // Returns whether the view manages its zoom level independently of other |
| 113 // views displaying content from the same host. |
| 114 virtual bool UsesTemporaryZoomLevel(int render_process_id, |
| 115 int render_view_id) const = 0; |
| 116 |
| 117 // Sets the temporary zoom level that's only valid for the lifetime of this |
| 118 // WebContents. |
| 119 // |
| 120 // This should only be called on the UI thread. |
| 121 virtual void SetTemporaryZoomLevel(int render_process_id, |
| 122 int render_view_id, |
| 123 double level) = 0; |
| 124 |
| 125 // Clears the temporary zoom level stored for this WebContents. |
| 126 // |
| 127 // This should only be called on the UI thread. |
| 128 virtual void ClearTemporaryZoomLevel(int render_process_id, |
| 129 int render_view_id) = 0; |
| 130 |
105 // Get/Set the default zoom level for pages that don't override it. | 131 // Get/Set the default zoom level for pages that don't override it. |
106 virtual double GetDefaultZoomLevel() const = 0; | 132 virtual double GetDefaultZoomLevel() const = 0; |
107 virtual void SetDefaultZoomLevel(double level) = 0;; | 133 virtual void SetDefaultZoomLevel(double level) = 0;; |
108 | 134 |
109 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; | 135 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; |
110 typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription | 136 typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription |
111 Subscription; | 137 Subscription; |
112 // Add and remove zoom level changed callbacks. | 138 // Add and remove zoom level changed callbacks. |
113 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 139 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
114 const ZoomLevelChangedCallback& callback) = 0; | 140 const ZoomLevelChangedCallback& callback) = 0; |
115 | 141 |
116 protected: | 142 protected: |
117 virtual ~HostZoomMap() {} | 143 virtual ~HostZoomMap() {} |
118 }; | 144 }; |
119 | 145 |
120 } // namespace content | 146 } // namespace content |
121 | 147 |
122 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 148 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |