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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class BrowserContext; | 18 class BrowserContext; |
18 class ResourceContext; | 19 class ResourceContext; |
19 | 20 |
20 // Maps hostnames to custom zoom levels. Written on the UI thread and read on | 21 // Maps hostnames to custom zoom levels. Written on the UI thread and read on |
21 // any thread. One instance per browser context. Must be created on the UI | 22 // any thread. One instance per browser context. Must be created on the UI |
22 // thread, and it'll delete itself on the UI thread as well. | 23 // thread, and it'll delete itself on the UI thread as well. |
(...skipping 20 matching lines...) Expand all Loading... |
43 // the level matches the current default zoom level, the host is erased | 44 // the level matches the current default zoom level, the host is erased |
44 // from the saved preferences; otherwise the new value is written out. | 45 // from the saved preferences; otherwise the new value is written out. |
45 // | 46 // |
46 // This should only be called on the UI thread. | 47 // This should only be called on the UI thread. |
47 virtual void SetZoomLevel(const std::string& host, double level) = 0; | 48 virtual void SetZoomLevel(const std::string& host, double level) = 0; |
48 | 49 |
49 // Get/Set the default zoom level for pages that don't override it. | 50 // Get/Set the default zoom level for pages that don't override it. |
50 virtual double GetDefaultZoomLevel() const = 0; | 51 virtual double GetDefaultZoomLevel() const = 0; |
51 virtual void SetDefaultZoomLevel(double level) = 0;; | 52 virtual void SetDefaultZoomLevel(double level) = 0;; |
52 | 53 |
| 54 typedef base::Callback<void(const std::string&)> ZoomLevelChangedCallback; |
| 55 |
| 56 // Add and remove zoom level changed callbacks. |
| 57 virtual void AddZoomLevelChangedCallback( |
| 58 const ZoomLevelChangedCallback& callback) = 0; |
| 59 virtual void RemoveZoomLevelChangedCallback( |
| 60 const ZoomLevelChangedCallback& callback) = 0; |
| 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 |