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 <tuple> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
15 #include "content/public/browser/host_zoom_map.h" | 16 #include "content/public/browser/host_zoom_map.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 typedef std::map<std::string, double> HostZoomLevels; | 106 typedef std::map<std::string, double> HostZoomLevels; |
106 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; | 107 typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels; |
107 | 108 |
108 struct RenderViewKey { | 109 struct RenderViewKey { |
109 int render_process_id; | 110 int render_process_id; |
110 int render_view_id; | 111 int render_view_id; |
111 RenderViewKey(int render_process_id, int render_view_id) | 112 RenderViewKey(int render_process_id, int render_view_id) |
112 : render_process_id(render_process_id), | 113 : render_process_id(render_process_id), |
113 render_view_id(render_view_id) {} | 114 render_view_id(render_view_id) {} |
114 bool operator<(const RenderViewKey& other) const { | 115 bool operator<(const RenderViewKey& other) const { |
115 return render_process_id < other.render_process_id || | 116 return std::tie(render_process_id, render_view_id) < |
116 ((render_process_id == other.render_process_id) && | 117 std::tie(other.render_process_id, other.render_view_id); |
117 (render_view_id < other.render_view_id)); | |
118 } | 118 } |
119 }; | 119 }; |
120 | 120 |
121 typedef std::map<RenderViewKey, double> TemporaryZoomLevels; | 121 typedef std::map<RenderViewKey, double> TemporaryZoomLevels; |
122 typedef std::map<RenderViewKey, bool> ViewPageScaleFactorsAreOne; | 122 typedef std::map<RenderViewKey, bool> ViewPageScaleFactorsAreOne; |
123 | 123 |
124 double GetZoomLevelForHost(const std::string& host) const; | 124 double GetZoomLevelForHost(const std::string& host) const; |
125 | 125 |
126 // Non-locked versions for internal use. These should only be called within | 126 // Non-locked versions for internal use. These should only be called within |
127 // a scope where a lock has been acquired. | 127 // a scope where a lock has been acquired. |
(...skipping 30 matching lines...) Expand all Loading... |
158 mutable base::Lock lock_; | 158 mutable base::Lock lock_; |
159 | 159 |
160 NotificationRegistrar registrar_; | 160 NotificationRegistrar registrar_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); | 162 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); |
163 }; | 163 }; |
164 | 164 |
165 } // namespace content | 165 } // namespace content |
166 | 166 |
167 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ | 167 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ |
OLD | NEW |