| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 }; | 50 }; |
| 51 | 51 |
| 52 typedef std::vector<ZoomLevelChange> ZoomLevelVector; |
| 53 |
| 52 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( | 54 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( |
| 53 BrowserContext* browser_context); | 55 BrowserContext* browser_context); |
| 54 | 56 |
| 55 // Copy the zoom levels from the given map. Can only be called on the UI | 57 // Copy the zoom levels from the given map. Can only be called on the UI |
| 56 // thread. | 58 // thread. |
| 57 virtual void CopyFrom(HostZoomMap* copy) = 0; | 59 virtual void CopyFrom(HostZoomMap* copy) = 0; |
| 58 | 60 |
| 59 // Here |host| is the host portion of URL, or (in the absence of a host) | 61 // Here |host| is the host portion of URL, or (in the absence of a host) |
| 60 // the complete spec of the URL. | 62 // the complete spec of the URL. |
| 61 // Returns the zoom for the specified |scheme| and |host|. See class | 63 // Returns the zoom for the specified |scheme| and |host|. See class |
| 62 // description for details. | 64 // description for details. |
| 63 // | 65 // |
| 64 // This may be called on any thread. | 66 // This may be called on any thread. |
| 65 virtual double GetZoomLevelForHostAndScheme( | 67 virtual double GetZoomLevelForHostAndScheme( |
| 66 const std::string& scheme, | 68 const std::string& scheme, |
| 67 const std::string& host) const = 0; | 69 const std::string& host) const = 0; |
| 68 | 70 |
| 71 // Returns all non-temporary zoom levels. Can only be called on any thread. |
| 72 virtual ZoomLevelVector GetAllZoomLevels() const = 0; |
| 73 |
| 69 // Here |host| is the host portion of URL, or (in the absence of a host) | 74 // Here |host| is the host portion of URL, or (in the absence of a host) |
| 70 // the complete spec of the URL. | 75 // the complete spec of the URL. |
| 71 // Sets the zoom level for the |host| to |level|. If the level matches the | 76 // Sets the zoom level for the |host| to |level|. If the level matches the |
| 72 // current default zoom level, the host is erased from the saved preferences; | 77 // current default zoom level, the host is erased from the saved preferences; |
| 73 // otherwise the new value is written out. | 78 // otherwise the new value is written out. |
| 74 // Zoom levels specified for both scheme and host are not affected. | 79 // Zoom levels specified for both scheme and host are not affected. |
| 75 // | 80 // |
| 76 // This should only be called on the UI thread. | 81 // This should only be called on the UI thread. |
| 77 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; | 82 virtual void SetZoomLevelForHost(const std::string& host, double level) = 0; |
| 78 | 83 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 98 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 103 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
| 99 const ZoomLevelChangedCallback& callback) = 0; | 104 const ZoomLevelChangedCallback& callback) = 0; |
| 100 | 105 |
| 101 protected: | 106 protected: |
| 102 virtual ~HostZoomMap() {} | 107 virtual ~HostZoomMap() {} |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace content | 110 } // namespace content |
| 106 | 111 |
| 107 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 112 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
| OLD | NEW |