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 20 matching lines...) Expand all Loading... | |
31 virtual void CopyFrom(HostZoomMap* copy) = 0; | 31 virtual void CopyFrom(HostZoomMap* copy) = 0; |
32 | 32 |
33 // Returns the zoom level for the host or spec for a given url. The zoom | 33 // Returns the zoom level for the host or spec for a given url. The zoom |
34 // level is determined by the host portion of the URL, or (in the absence of | 34 // level is determined by the host portion of the URL, or (in the absence of |
35 // a host) the complete spec of the URL. In most cases, there is no custom | 35 // a host) the complete spec of the URL. In most cases, there is no custom |
36 // zoom level, and this returns the user's default zoom level. Otherwise, | 36 // zoom level, and this returns the user's default zoom level. Otherwise, |
37 // returns the saved zoom level, which may be positive (to zoom in) or | 37 // returns the saved zoom level, which may be positive (to zoom in) or |
38 // negative (to zoom out). | 38 // negative (to zoom out). |
39 // | 39 // |
40 // This may be called on any thread. | 40 // This may be called on any thread. |
41 virtual double GetZoomLevel(const std::string& host) const = 0; | 41 virtual double GetZoomLevelForHost(const std::string& host) const = 0; |
sky
2013/02/12 18:47:15
How can we can keep this exposed as public? Doing
| |
42 | |
43 // Returns the zoom level for the host or spec for a given url, taking | |
sky
2013/02/12 18:47:15
Update description for both this and GetZoomLevelF
| |
44 // |scheme| in account. If there is specific zoom level specified for given | |
45 // |scheme| and |host| pair, it will be returned. In other cases result is | |
46 // equivalent to GetZoomLevelForHost(host). | |
47 // | |
48 // This may be called on any thread. | |
49 virtual double GetZoomLevelForHostAndScheme( | |
50 const std::string& scheme, | |
51 const std::string& host) const = 0; | |
42 | 52 |
43 // Sets the zoom level for the host or spec for a given url to |level|. If | 53 // Sets the zoom level for the host or spec for a given url to |level|. If |
44 // the level matches the current default zoom level, the host is erased | 54 // the level matches the current default zoom level, the host is erased |
45 // from the saved preferences; otherwise the new value is written out. | 55 // from the saved preferences; otherwise the new value is written out. |
46 // | 56 // |
47 // This should only be called on the UI thread. | 57 // This should only be called on the UI thread. |
48 virtual void SetZoomLevel(const std::string& host, double level) = 0; | 58 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; |
59 | |
60 // Sets the zoom level for the |scheme|/|host| pair to |level|. | |
61 // | |
62 // This should only be called on the UI thread. | |
63 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, | |
64 const std::string& host, | |
65 double level) = 0; | |
49 | 66 |
50 // Get/Set the default zoom level for pages that don't override it. | 67 // Get/Set the default zoom level for pages that don't override it. |
51 virtual double GetDefaultZoomLevel() const = 0; | 68 virtual double GetDefaultZoomLevel() const = 0; |
52 virtual void SetDefaultZoomLevel(double level) = 0;; | 69 virtual void SetDefaultZoomLevel(double level) = 0;; |
53 | 70 |
54 typedef base::Callback<void(const std::string&)> ZoomLevelChangedCallback; | 71 typedef base::Callback<void(const std::string&)> ZoomLevelChangedCallback; |
55 | 72 |
56 // Add and remove zoom level changed callbacks. | 73 // Add and remove zoom level changed callbacks. |
57 virtual void AddZoomLevelChangedCallback( | 74 virtual void AddZoomLevelChangedCallback( |
58 const ZoomLevelChangedCallback& callback) = 0; | 75 const ZoomLevelChangedCallback& callback) = 0; |
59 virtual void RemoveZoomLevelChangedCallback( | 76 virtual void RemoveZoomLevelChangedCallback( |
60 const ZoomLevelChangedCallback& callback) = 0; | 77 const ZoomLevelChangedCallback& callback) = 0; |
61 | 78 |
62 protected: | 79 protected: |
63 virtual ~HostZoomMap() {} | 80 virtual ~HostZoomMap() {} |
64 }; | 81 }; |
65 | 82 |
66 } // namespace content | 83 } // namespace content |
67 | 84 |
68 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 85 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |