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_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 const ZoomLevelChangedCallback& callback) OVERRIDE; | 47 const ZoomLevelChangedCallback& callback) OVERRIDE; |
48 | 48 |
49 // Returns the temporary zoom level that's only valid for the lifetime of | 49 // Returns the temporary zoom level that's only valid for the lifetime of |
50 // the given WebContents (i.e. isn't saved and doesn't affect other | 50 // the given WebContents (i.e. isn't saved and doesn't affect other |
51 // WebContentses) if it exists, the default zoom level otherwise. | 51 // WebContentses) if it exists, the default zoom level otherwise. |
52 // | 52 // |
53 // This may be called on any thread. | 53 // This may be called on any thread. |
54 double GetTemporaryZoomLevel(int render_process_id, | 54 double GetTemporaryZoomLevel(int render_process_id, |
55 int render_view_id) const; | 55 int render_view_id) const; |
56 | 56 |
57 // Passes a zoom ID along to the ZoomController. | |
Fady Samuel
2014/04/07 21:27:24
ZoomController is a chrome concept. Remove referen
paulmeyer
2014/04/08 21:13:20
Done.
| |
58 virtual void SetZoomLevelForHost( | |
59 const std::string& host, | |
60 int zoom_id, | |
61 double level); | |
62 | |
57 // Sets the temporary zoom level that's only valid for the lifetime of this | 63 // Sets the temporary zoom level that's only valid for the lifetime of this |
58 // WebContents. | 64 // WebContents. |
59 // | 65 // |
60 // This should only be called on the UI thread. | 66 // This should only be called on the UI thread. |
61 void SetTemporaryZoomLevel(int render_process_id, | 67 void SetTemporaryZoomLevel(int render_process_id, |
62 int render_view_id, | 68 int render_view_id, |
69 const std::string& host, | |
70 int zoom_id, | |
63 double level); | 71 double level); |
64 | 72 |
65 // NotificationObserver implementation. | 73 // NotificationObserver implementation. |
66 virtual void Observe(int type, | 74 virtual void Observe(int type, |
67 const NotificationSource& source, | 75 const NotificationSource& source, |
68 const NotificationDetails& details) OVERRIDE; | 76 const NotificationDetails& details) OVERRIDE; |
69 | 77 |
70 private: | 78 private: |
79 // Erases an entry in |temporary_zoom_levels_|. | |
80 void EraseTemporaryZoomLevel(int render_process_id, int render_view_id); | |
81 | |
71 double GetZoomLevelForHost(const std::string& host) const; | 82 double GetZoomLevelForHost(const std::string& host) const; |
72 | 83 |
84 // Notifies the renderers from this browser context to change the zoom level | |
85 // for the specified host and scheme. | |
86 void SendZoomLevelChange(const std::string& scheme, | |
87 const std::string& host, | |
88 double level); | |
89 | |
73 typedef std::map<std::string, double> HostZoomLevels; | 90 typedef std::map<std::string, double> HostZoomLevels; |
74 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; | 91 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; |
75 | 92 |
76 // Callbacks called when zoom level changes. | 93 // Callbacks called when zoom level changes. |
77 base::CallbackList<void(const ZoomLevelChange&)> | 94 base::CallbackList<void(const ZoomLevelChange&)> |
78 zoom_level_changed_callbacks_; | 95 zoom_level_changed_callbacks_; |
79 | 96 |
80 // Copy of the pref data, so that we can read it on the IO thread. | 97 // Copy of the pref data, so that we can read it on the IO thread. |
81 HostZoomLevels host_zoom_levels_; | 98 HostZoomLevels host_zoom_levels_; |
82 SchemeHostZoomLevels scheme_host_zoom_levels_; | 99 SchemeHostZoomLevels scheme_host_zoom_levels_; |
(...skipping 14 matching lines...) Expand all Loading... | |
97 mutable base::Lock lock_; | 114 mutable base::Lock lock_; |
98 | 115 |
99 NotificationRegistrar registrar_; | 116 NotificationRegistrar registrar_; |
100 | 117 |
101 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 118 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
102 }; | 119 }; |
103 | 120 |
104 } // namespace content | 121 } // namespace content |
105 | 122 |
106 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 123 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
OLD | NEW |