| 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 27 matching lines...) Expand all Loading... |
| 38 ZoomLevelVector GetAllZoomLevels() const override; | 38 ZoomLevelVector GetAllZoomLevels() const override; |
| 39 void SetZoomLevelForHost(const std::string& host, double level) override; | 39 void SetZoomLevelForHost(const std::string& host, double level) override; |
| 40 void SetZoomLevelForHostAndScheme(const std::string& scheme, | 40 void SetZoomLevelForHostAndScheme(const std::string& scheme, |
| 41 const std::string& host, | 41 const std::string& host, |
| 42 double level) override; | 42 double level) override; |
| 43 bool UsesTemporaryZoomLevel(int render_process_id, | 43 bool UsesTemporaryZoomLevel(int render_process_id, |
| 44 int render_view_id) const override; | 44 int render_view_id) const override; |
| 45 void SetTemporaryZoomLevel(int render_process_id, | 45 void SetTemporaryZoomLevel(int render_process_id, |
| 46 int render_view_id, | 46 int render_view_id, |
| 47 double level) override; | 47 double level) override; |
| 48 double GetTemporaryZoomLevel(int render_process_id, |
| 49 int render_view_id) const override; |
| 48 | 50 |
| 49 void ClearTemporaryZoomLevel(int render_process_id, | 51 void ClearTemporaryZoomLevel(int render_process_id, |
| 50 int render_view_id) override; | 52 int render_view_id) override; |
| 51 double GetDefaultZoomLevel() const override; | 53 double GetDefaultZoomLevel() const override; |
| 52 void SetDefaultZoomLevel(double level) override; | 54 void SetDefaultZoomLevel(double level) override; |
| 53 scoped_ptr<Subscription> AddZoomLevelChangedCallback( | 55 scoped_ptr<Subscription> AddZoomLevelChangedCallback( |
| 54 const ZoomLevelChangedCallback& callback) override; | 56 const ZoomLevelChangedCallback& callback) override; |
| 55 | 57 |
| 56 // Returns the current zoom level for the specified WebContents. This may | 58 // Returns the current zoom level for the specified WebContents. This may |
| 57 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). | 59 // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). |
| 58 double GetZoomLevelForWebContents( | 60 double GetZoomLevelForWebContents( |
| 59 const WebContentsImpl& web_contents_impl) const; | 61 const WebContentsImpl& web_contents_impl) const; |
| 60 | 62 |
| 61 // Sets the zoom level for this WebContents. If this WebContents is using | 63 // Sets the zoom level for this WebContents. If this WebContents is using |
| 62 // a temporary zoom level, then level is only applied to this WebContents. | 64 // a temporary zoom level, then level is only applied to this WebContents. |
| 63 // Otherwise, the level will be applied on a host level. | 65 // Otherwise, the level will be applied on a host level. |
| 64 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, | 66 void SetZoomLevelForWebContents(const WebContentsImpl& web_contents_impl, |
| 65 double level); | 67 double level); |
| 66 | 68 |
| 67 // Sets the zoom level for the specified view. The level may be set for only | 69 // Sets the zoom level for the specified view. The level may be set for only |
| 68 // this view, or for the host, depending on UsesTemporaryZoomLevel(). | 70 // this view, or for the host, depending on UsesTemporaryZoomLevel(). |
| 69 void SetZoomLevelForView(int render_process_id, | 71 void SetZoomLevelForView(int render_process_id, |
| 70 int render_view_id, | 72 int render_view_id, |
| 71 double level, | 73 double level, |
| 72 const std::string& host); | 74 const std::string& host); |
| 73 | 75 |
| 74 // Returns the temporary zoom level that's only valid for the lifetime of | |
| 75 // the given WebContents (i.e. isn't saved and doesn't affect other | |
| 76 // WebContentses) if it exists, the default zoom level otherwise. | |
| 77 // | |
| 78 // This may be called on any thread. | |
| 79 double GetTemporaryZoomLevel(int render_process_id, | |
| 80 int render_view_id) const; | |
| 81 | |
| 82 // NotificationObserver implementation. | 76 // NotificationObserver implementation. |
| 83 void Observe(int type, | 77 void Observe(int type, |
| 84 const NotificationSource& source, | 78 const NotificationSource& source, |
| 85 const NotificationDetails& details) override; | 79 const NotificationDetails& details) override; |
| 86 | 80 |
| 87 void SendErrorPageZoomLevelRefresh(); | 81 void SendErrorPageZoomLevelRefresh(); |
| 88 | 82 |
| 89 private: | 83 private: |
| 90 typedef std::map<std::string, double> HostZoomLevels; | 84 typedef std::map<std::string, double> HostZoomLevels; |
| 91 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; | 85 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 mutable base::Lock lock_; | 126 mutable base::Lock lock_; |
| 133 | 127 |
| 134 NotificationRegistrar registrar_; | 128 NotificationRegistrar registrar_; |
| 135 | 129 |
| 136 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 130 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
| 137 }; | 131 }; |
| 138 | 132 |
| 139 } // namespace content | 133 } // namespace content |
| 140 | 134 |
| 141 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 135 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
| OLD | NEW |