Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/browser/host_zoom_map.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698