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 23 matching lines...) Expand all Loading... |
34 const std::string& scheme, | 34 const std::string& scheme, |
35 const std::string& host) const OVERRIDE; | 35 const std::string& host) const OVERRIDE; |
36 virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE; | 36 virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE; |
37 virtual void SetZoomLevelForHost( | 37 virtual void SetZoomLevelForHost( |
38 const std::string& host, | 38 const std::string& host, |
39 double level) OVERRIDE; | 39 double level) OVERRIDE; |
40 virtual void SetZoomLevelForHostAndScheme( | 40 virtual void SetZoomLevelForHostAndScheme( |
41 const std::string& scheme, | 41 const std::string& scheme, |
42 const std::string& host, | 42 const std::string& host, |
43 double level) OVERRIDE; | 43 double level) OVERRIDE; |
| 44 virtual void SetTemporaryZoomLevel(int render_process_id, |
| 45 int render_view_id, |
| 46 const std::string& host, |
| 47 double level) OVERRIDE; |
| 48 virtual void EraseTemporaryZoomLevel(int render_process_id, |
| 49 int render_view_id) OVERRIDE; |
44 virtual double GetDefaultZoomLevel() const OVERRIDE; | 50 virtual double GetDefaultZoomLevel() const OVERRIDE; |
45 virtual void SetDefaultZoomLevel(double level) OVERRIDE; | 51 virtual void SetDefaultZoomLevel(double level) OVERRIDE; |
46 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 52 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
47 const ZoomLevelChangedCallback& callback) OVERRIDE; | 53 const ZoomLevelChangedCallback& callback) OVERRIDE; |
48 | 54 |
49 // Returns the temporary zoom level that's only valid for the lifetime of | 55 // 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 | 56 // the given WebContents (i.e. isn't saved and doesn't affect other |
51 // WebContentses) if it exists, the default zoom level otherwise. | 57 // WebContentses) if it exists, the default zoom level otherwise. |
52 // | 58 // |
53 // This may be called on any thread. | 59 // This may be called on any thread. |
54 double GetTemporaryZoomLevel(int render_process_id, | 60 double GetTemporaryZoomLevel(int render_process_id, |
55 int render_view_id) const; | 61 int render_view_id) const; |
56 | 62 |
57 // Sets the temporary zoom level that's only valid for the lifetime of this | |
58 // WebContents. | |
59 // | |
60 // This should only be called on the UI thread. | |
61 void SetTemporaryZoomLevel(int render_process_id, | |
62 int render_view_id, | |
63 double level); | |
64 | |
65 // NotificationObserver implementation. | 63 // NotificationObserver implementation. |
66 virtual void Observe(int type, | 64 virtual void Observe(int type, |
67 const NotificationSource& source, | 65 const NotificationSource& source, |
68 const NotificationDetails& details) OVERRIDE; | 66 const NotificationDetails& details) OVERRIDE; |
69 | 67 |
70 private: | 68 private: |
71 double GetZoomLevelForHost(const std::string& host) const; | 69 double GetZoomLevelForHost(const std::string& host) const; |
72 | 70 |
| 71 // Notifies the renderers from this browser context to change the zoom level |
| 72 // for the specified host and scheme. |
| 73 void SendZoomLevelChange(const std::string& scheme, |
| 74 const std::string& host, |
| 75 double level); |
| 76 |
73 typedef std::map<std::string, double> HostZoomLevels; | 77 typedef std::map<std::string, double> HostZoomLevels; |
74 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; | 78 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; |
75 | 79 |
76 // Callbacks called when zoom level changes. | 80 // Callbacks called when zoom level changes. |
77 base::CallbackList<void(const ZoomLevelChange&)> | 81 base::CallbackList<void(const ZoomLevelChange&)> |
78 zoom_level_changed_callbacks_; | 82 zoom_level_changed_callbacks_; |
79 | 83 |
80 // Copy of the pref data, so that we can read it on the IO thread. | 84 // Copy of the pref data, so that we can read it on the IO thread. |
81 HostZoomLevels host_zoom_levels_; | 85 HostZoomLevels host_zoom_levels_; |
82 SchemeHostZoomLevels scheme_host_zoom_levels_; | 86 SchemeHostZoomLevels scheme_host_zoom_levels_; |
(...skipping 14 matching lines...) Expand all Loading... |
97 mutable base::Lock lock_; | 101 mutable base::Lock lock_; |
98 | 102 |
99 NotificationRegistrar registrar_; | 103 NotificationRegistrar registrar_; |
100 | 104 |
101 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 105 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
102 }; | 106 }; |
103 | 107 |
104 } // namespace content | 108 } // namespace content |
105 | 109 |
106 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 110 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
OLD | NEW |