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 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "content/browser/host_zoom_map_impl.h" | 7 #include "content/browser/host_zoom_map_impl.h" |
8 | 8 |
9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 host_zoom_levels_[i->first] = i->second; | 64 host_zoom_levels_[i->first] = i->second; |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 double HostZoomMapImpl::GetZoomLevel(const std::string& host) const { | 68 double HostZoomMapImpl::GetZoomLevel(const std::string& host) const { |
69 base::AutoLock auto_lock(lock_); | 69 base::AutoLock auto_lock(lock_); |
70 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); | 70 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); |
71 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; | 71 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; |
72 } | 72 } |
73 | 73 |
74 void HostZoomMapImpl::SetZoomLevel(std::string host, double level) { | 74 void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) { |
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
76 | 76 |
77 { | 77 { |
78 base::AutoLock auto_lock(lock_); | 78 base::AutoLock auto_lock(lock_); |
79 | 79 |
80 if (content::ZoomValuesEqual(level, default_zoom_level_)) | 80 if (content::ZoomValuesEqual(level, default_zoom_level_)) |
81 host_zoom_levels_.erase(host); | 81 host_zoom_levels_.erase(host); |
82 else | 82 else |
83 host_zoom_levels_[host] = level; | 83 host_zoom_levels_[host] = level; |
84 } | 84 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 break; | 178 break; |
179 } | 179 } |
180 default: | 180 default: |
181 NOTREACHED() << "Unexpected preference observed."; | 181 NOTREACHED() << "Unexpected preference observed."; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 HostZoomMapImpl::~HostZoomMapImpl() { | 185 HostZoomMapImpl::~HostZoomMapImpl() { |
186 } | 186 } |
OLD | NEW |