| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( | 65 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( |
| 66 host, &zoom_level); | 66 host, &zoom_level); |
| 67 DCHECK(success); | 67 DCHECK(success); |
| 68 host_zoom_levels_[host] = zoom_level; | 68 host_zoom_levels_[host] = zoom_level; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 void HostZoomMap::RegisterUserPrefs(PrefService* prefs) { | 74 void HostZoomMap::RegisterUserPrefs(PrefService* prefs) { |
| 75 prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, 0.0); | 75 prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, |
| 76 prefs->RegisterDictionaryPref(prefs::kPerHostZoomLevels); | 76 0.0, |
| 77 PrefService::UNSYNCABLE_PREF); |
| 78 prefs->RegisterDictionaryPref(prefs::kPerHostZoomLevels, |
| 79 PrefService::UNSYNCABLE_PREF); |
| 77 } | 80 } |
| 78 | 81 |
| 79 double HostZoomMap::GetZoomLevel(const GURL& url) const { | 82 double HostZoomMap::GetZoomLevel(const GURL& url) const { |
| 80 std::string host(net::GetHostOrSpecFromURL(url)); | 83 std::string host(net::GetHostOrSpecFromURL(url)); |
| 81 base::AutoLock auto_lock(lock_); | 84 base::AutoLock auto_lock(lock_); |
| 82 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); | 85 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); |
| 83 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; | 86 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; |
| 84 } | 87 } |
| 85 | 88 |
| 86 void HostZoomMap::SetZoomLevel(const GURL& url, double level) { | 89 void HostZoomMap::SetZoomLevel(const GURL& url, double level) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 break; | 222 break; |
| 220 } | 223 } |
| 221 default: | 224 default: |
| 222 NOTREACHED() << "Unexpected preference observed."; | 225 NOTREACHED() << "Unexpected preference observed."; |
| 223 } | 226 } |
| 224 } | 227 } |
| 225 | 228 |
| 226 HostZoomMap::~HostZoomMap() { | 229 HostZoomMap::~HostZoomMap() { |
| 227 Shutdown(); | 230 Shutdown(); |
| 228 } | 231 } |
| OLD | NEW |