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 "base/callback.h" |
| 14 #include "base/callback_list.h" |
14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class BrowserContext; | 19 class BrowserContext; |
19 class ResourceContext; | 20 class ResourceContext; |
20 | 21 |
21 // Maps hostnames to custom zoom levels. Written on the UI thread and read on | 22 // Maps hostnames to custom zoom levels. Written on the UI thread and read on |
22 // any thread. One instance per browser context. Must be created on the UI | 23 // any thread. One instance per browser context. Must be created on the UI |
23 // thread, and it'll delete itself on the UI thread as well. | 24 // thread, and it'll delete itself on the UI thread as well. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // This should only be called on the UI thread. | 85 // This should only be called on the UI thread. |
85 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, | 86 virtual void SetZoomLevelForHostAndScheme(const std::string& scheme, |
86 const std::string& host, | 87 const std::string& host, |
87 double level) = 0; | 88 double level) = 0; |
88 | 89 |
89 // Get/Set the default zoom level for pages that don't override it. | 90 // Get/Set the default zoom level for pages that don't override it. |
90 virtual double GetDefaultZoomLevel() const = 0; | 91 virtual double GetDefaultZoomLevel() const = 0; |
91 virtual void SetDefaultZoomLevel(double level) = 0;; | 92 virtual void SetDefaultZoomLevel(double level) = 0;; |
92 | 93 |
93 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; | 94 typedef base::Callback<void(const ZoomLevelChange&)> ZoomLevelChangedCallback; |
94 | 95 typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription |
| 96 Subscription; |
95 // Add and remove zoom level changed callbacks. | 97 // Add and remove zoom level changed callbacks. |
96 virtual void AddZoomLevelChangedCallback( | 98 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
97 const ZoomLevelChangedCallback& callback) = 0; | |
98 virtual void RemoveZoomLevelChangedCallback( | |
99 const ZoomLevelChangedCallback& callback) = 0; | 99 const ZoomLevelChangedCallback& callback) = 0; |
100 | 100 |
101 protected: | 101 protected: |
102 virtual ~HostZoomMap() {} | 102 virtual ~HostZoomMap() {} |
103 }; | 103 }; |
104 | 104 |
105 } // namespace content | 105 } // namespace content |
106 | 106 |
107 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ | 107 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ |
OLD | NEW |