| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Maps hostnames to custom zoom levels. Written on the UI thread and read on | 5 // Maps hostnames to custom zoom levels. Written on the UI thread and read on |
| 6 // any thread. One instance per profile. | 6 // any thread. One instance per profile. |
| 7 | 7 |
| 8 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 8 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_H_ |
| 9 #define CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 9 #define CONTENT_BROWSER_HOST_ZOOM_MAP_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 double default_zoom_level() const { return default_zoom_level_; } | 71 double default_zoom_level() const { return default_zoom_level_; } |
| 72 void set_default_zoom_level(double level) { default_zoom_level_ = level; } | 72 void set_default_zoom_level(double level) { default_zoom_level_ = level; } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 75 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 76 friend class DeleteTask<HostZoomMap>; | 76 friend class DeleteTask<HostZoomMap>; |
| 77 | 77 |
| 78 typedef std::map<std::string, double> HostZoomLevels; | 78 typedef std::map<std::string, double> HostZoomLevels; |
| 79 | 79 |
| 80 ~HostZoomMap(); | 80 virtual ~HostZoomMap(); |
| 81 | 81 |
| 82 // Copy of the pref data, so that we can read it on the IO thread. | 82 // Copy of the pref data, so that we can read it on the IO thread. |
| 83 HostZoomLevels host_zoom_levels_; | 83 HostZoomLevels host_zoom_levels_; |
| 84 double default_zoom_level_; | 84 double default_zoom_level_; |
| 85 | 85 |
| 86 struct TemporaryZoomLevel { | 86 struct TemporaryZoomLevel { |
| 87 int render_process_id; | 87 int render_process_id; |
| 88 int render_view_id; | 88 int render_view_id; |
| 89 double zoom_level; | 89 double zoom_level; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 // Don't expect more than a couple of tabs that are using a temporary zoom | 92 // Don't expect more than a couple of tabs that are using a temporary zoom |
| 93 // level, so vector is fine for now. | 93 // level, so vector is fine for now. |
| 94 std::vector<TemporaryZoomLevel> temporary_zoom_levels_; | 94 std::vector<TemporaryZoomLevel> temporary_zoom_levels_; |
| 95 | 95 |
| 96 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and | 96 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and |
| 97 // |temporary_zoom_levels_| to guarantee thread safety. | 97 // |temporary_zoom_levels_| to guarantee thread safety. |
| 98 mutable base::Lock lock_; | 98 mutable base::Lock lock_; |
| 99 | 99 |
| 100 NotificationRegistrar registrar_; | 100 NotificationRegistrar registrar_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); | 102 DISALLOW_COPY_AND_ASSIGN(HostZoomMap); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ | 105 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_H_ |
| OLD | NEW |