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 29 matching lines...) Expand all Loading... |
40 // renderer, no scheme/host is specified. | 40 // renderer, no scheme/host is specified. |
41 }; | 41 }; |
42 | 42 |
43 // Structure used to notify about zoom changes. Host and/or scheme are empty | 43 // Structure used to notify about zoom changes. Host and/or scheme are empty |
44 // if not applicable to |mode|. | 44 // if not applicable to |mode|. |
45 struct ZoomLevelChange { | 45 struct ZoomLevelChange { |
46 ZoomLevelChangeMode mode; | 46 ZoomLevelChangeMode mode; |
47 std::string host; | 47 std::string host; |
48 std::string scheme; | 48 std::string scheme; |
49 double zoom_level; | 49 double zoom_level; |
| 50 int zoom_id; |
50 }; | 51 }; |
51 | 52 |
52 typedef std::vector<ZoomLevelChange> ZoomLevelVector; | 53 typedef std::vector<ZoomLevelChange> ZoomLevelVector; |
53 | 54 |
54 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( | 55 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( |
55 BrowserContext* browser_context); | 56 BrowserContext* browser_context); |
56 | 57 |
57 // Copy the zoom levels from the given map. Can only be called on the UI | 58 // Copy the zoom levels from the given map. Can only be called on the UI |
58 // thread. | 59 // thread. |
59 virtual void CopyFrom(HostZoomMap* copy) = 0; | 60 virtual void CopyFrom(HostZoomMap* copy) = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
72 virtual ZoomLevelVector GetAllZoomLevels() const = 0; | 73 virtual ZoomLevelVector GetAllZoomLevels() const = 0; |
73 | 74 |
74 // Here |host| is the host portion of URL, or (in the absence of a host) | 75 // Here |host| is the host portion of URL, or (in the absence of a host) |
75 // the complete spec of the URL. | 76 // the complete spec of the URL. |
76 // Sets the zoom level for the |host| to |level|. If the level matches the | 77 // Sets the zoom level for the |host| to |level|. If the level matches the |
77 // current default zoom level, the host is erased from the saved preferences; | 78 // current default zoom level, the host is erased from the saved preferences; |
78 // otherwise the new value is written out. | 79 // otherwise the new value is written out. |
79 // Zoom levels specified for both scheme and host are not affected. | 80 // Zoom levels specified for both scheme and host are not affected. |
80 // | 81 // |
81 // This should only be called on the UI thread. | 82 // This should only be called on the UI thread. |
82 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; | 83 virtual void SetZoomLevelForHost(const std::string& host, |
| 84 double level) = 0; |
83 | 85 |
84 // Here |host| is the host portion of URL, or (in the absence of a host) | 86 // Here |host| is the host portion of URL, or (in the absence of a host) |
85 // the complete spec of the URL. | 87 // the complete spec of the URL. |
86 // Sets the zoom level for the |scheme|/|host| pair to |level|. No values | 88 // Sets the zoom level for the |scheme|/|host| pair to |level|. No values |
87 // will be erased during this operation, and this value will not be stored in | 89 // will be erased during this operation, and this value will not be stored in |
88 // the preferences. | 90 // the preferences. |
89 // | 91 // |
90 // This should only be called on the UI thread. | 92 // This should only be called on the UI thread. |
91 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, | 93 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, |
92 const std::string& host, | 94 const std::string& host, |
(...skipping 10 matching lines...) Expand all Loading... |
103 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 105 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
104 const ZoomLevelChangedCallback& callback) = 0; | 106 const ZoomLevelChangedCallback& callback) = 0; |
105 | 107 |
106 protected: | 108 protected: |
107 virtual ~HostZoomMap() {} | 109 virtual ~HostZoomMap() {} |
108 }; | 110 }; |
109 | 111 |
110 } // namespace content | 112 } // namespace content |
111 | 113 |
112 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 114 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |