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 11 matching lines...) Expand all Loading... |
22 // thread, and it'll delete itself on the UI thread as well. | 22 // thread, and it'll delete itself on the UI thread as well. |
23 class HostZoomMap { | 23 class HostZoomMap { |
24 public: | 24 public: |
25 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( | 25 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( |
26 BrowserContext* browser_context); | 26 BrowserContext* browser_context); |
27 | 27 |
28 // Copy the zoom levels from the given map. Can only be called on the UI | 28 // Copy the zoom levels from the given map. Can only be called on the UI |
29 // thread. | 29 // thread. |
30 virtual void CopyFrom(HostZoomMap* copy) = 0; | 30 virtual void CopyFrom(HostZoomMap* copy) = 0; |
31 | 31 |
32 // Returns the zoom level for the host or spec for a given url. The zoom | 32 // Returns the zoom level for the host or spec for a given url, taking |
33 // level is determined by the host portion of the URL, or (in the absence of | 33 // |scheme| in account. If |scheme| is specified and there is specific zoom |
34 // a host) the complete spec of the URL. In most cases, there is no custom | 34 // level specified for given |scheme| and |host| pair, it will be returned. |
35 // zoom level, and this returns the user's default zoom level. Otherwise, | 35 // In other cases the zoom level is determined by the host portion of the URL, |
36 // returns the saved zoom level, which may be positive (to zoom in) or | 36 // or (in the absence of a host) the complete spec of the URL. In most cases, |
37 // negative (to zoom out). | 37 // there is no custom zoom level, and this returns the user's default zoom |
| 38 // level. Otherwise, returns the saved zoom level, which may be positive |
| 39 // (to zoom in) or negative (to zoom out). |
38 // | 40 // |
39 // This may be called on any thread. | 41 // This may be called on any thread. |
40 virtual double GetZoomLevel(const std::string& host) const = 0; | 42 virtual double GetZoomLevel(const std::string& scheme, |
| 43 const std::string& host) const = 0; |
41 | 44 |
42 // Sets the zoom level for the host or spec for a given url to |level|. If | 45 // Sets the zoom level for the |scheme|/|host| pair to |level|. If |scheme| |
43 // the level matches the current default zoom level, the host is erased | 46 // is not specified, sets the zoom level for the host or spec for a given url |
44 // from the saved preferences; otherwise the new value is written out. | 47 // to |level|. If the level matches the current default zoom level, the host |
| 48 // is erased from the saved preferences; otherwise the new value is written |
| 49 // out. |
| 50 // |
| 51 // Only values without specified scheme will be stored in preferences. |
45 // | 52 // |
46 // This should only be called on the UI thread. | 53 // This should only be called on the UI thread. |
47 virtual void SetZoomLevel(const std::string& host, double level) = 0; | 54 virtual void SetZoomLevel(const std::string& scheme, |
| 55 const std::string& host, |
| 56 double level) = 0; |
48 | 57 |
49 // Get/Set the default zoom level for pages that don't override it. | 58 // Get/Set the default zoom level for pages that don't override it. |
50 virtual double GetDefaultZoomLevel() const = 0; | 59 virtual double GetDefaultZoomLevel() const = 0; |
51 virtual void SetDefaultZoomLevel(double level) = 0;; | 60 virtual void SetDefaultZoomLevel(double level) = 0;; |
52 | 61 |
53 protected: | 62 protected: |
54 virtual ~HostZoomMap() {} | 63 virtual ~HostZoomMap() {} |
55 }; | 64 }; |
56 | 65 |
57 } // namespace content | 66 } // namespace content |
58 | 67 |
59 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 68 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |