| 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 #include <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #include "content/browser/host_zoom_map.h" | 7 #include "content/browser/host_zoom_map.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 DCHECK(success); | 85 DCHECK(success); |
| 86 host_zoom_levels_[host] = zoom_level; | 86 host_zoom_levels_[host] = zoom_level; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 void HostZoomMap::RegisterUserPrefs(PrefService* prefs) { | 92 void HostZoomMap::RegisterUserPrefs(PrefService* prefs) { |
| 93 prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, 0.0); | 93 prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, |
| 94 prefs->RegisterDictionaryPref(prefs::kPerHostZoomLevels); | 94 0.0, |
| 95 false /* don't sync pref */); |
| 96 prefs->RegisterDictionaryPref(prefs::kPerHostZoomLevels, |
| 97 false /* don't sync pref */); |
| 95 } | 98 } |
| 96 | 99 |
| 97 double HostZoomMap::GetZoomLevel(const GURL& url) const { | 100 double HostZoomMap::GetZoomLevel(const GURL& url) const { |
| 98 std::string host(net::GetHostOrSpecFromURL(url)); | 101 std::string host(net::GetHostOrSpecFromURL(url)); |
| 99 base::AutoLock auto_lock(lock_); | 102 base::AutoLock auto_lock(lock_); |
| 100 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); | 103 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); |
| 101 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; | 104 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; |
| 102 } | 105 } |
| 103 | 106 |
| 104 void HostZoomMap::SetZoomLevel(const GURL& url, double level) { | 107 void HostZoomMap::SetZoomLevel(const GURL& url, double level) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 break; | 240 break; |
| 238 } | 241 } |
| 239 default: | 242 default: |
| 240 NOTREACHED() << "Unexpected preference observed."; | 243 NOTREACHED() << "Unexpected preference observed."; |
| 241 } | 244 } |
| 242 } | 245 } |
| 243 | 246 |
| 244 HostZoomMap::~HostZoomMap() { | 247 HostZoomMap::~HostZoomMap() { |
| 245 Shutdown(); | 248 Shutdown(); |
| 246 } | 249 } |
| OLD | NEW |