| 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 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 |
| 81 // Returns all non-temporary zoom levels. Can only be called on any thread. | 88 // Returns all non-temporary zoom levels. Can only 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 tabs |
| 113 // 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 // Notify a particular render view to change its zoom level. |
| 126 virtual void SendTemporaryZoomLevelChange(int render_process_id, |
| 127 int render_view_id) const = 0; |
| 128 |
| 129 // Clears the temporary zoom level stored for this WebContents. |
| 130 // |
| 131 // This should only be called on the UI thread. |
| 132 virtual void ClearTemporaryZoomLevel(int render_process_id, |
| 133 int render_view_id) = 0; |
| 134 |
| 105 // Get/Set the default zoom level for pages that don't override it. | 135 // Get/Set the default zoom level for pages that don't override it. |
| 106 virtual double GetDefaultZoomLevel() const = 0; | 136 virtual double GetDefaultZoomLevel() const = 0; |
| 107 virtual void SetDefaultZoomLevel(double level) = 0;; | 137 virtual void SetDefaultZoomLevel(double level) = 0;; |
| 108 | 138 |
| 109 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; | 139 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; |
| 110 typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription | 140 typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription |
| 111 Subscription; | 141 Subscription; |
| 112 // Add and remove zoom level changed callbacks. | 142 // Add and remove zoom level changed callbacks. |
| 113 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 143 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
| 114 const ZoomLevelChangedCallback& callback) = 0; | 144 const ZoomLevelChangedCallback& callback) = 0; |
| 115 | 145 |
| 116 protected: | 146 protected: |
| 117 virtual ~HostZoomMap() {} | 147 virtual ~HostZoomMap() {} |
| 118 }; | 148 }; |
| 119 | 149 |
| 120 } // namespace content | 150 } // namespace content |
| 121 | 151 |
| 122 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 152 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
| OLD | NEW |