summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_zoom_map.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 01:09:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 01:09:33 +0000
commit779c33638f4b10def2d103f4703fa5bf58899aec (patch)
tree7034c81d156706a56b8101d507c87cc7045e9cc9 /chrome/browser/host_zoom_map.cc
parent12cbfda3f72e24147789eed981e68c373ba1c14f (diff)
downloadchromium_src-779c33638f4b10def2d103f4703fa5bf58899aec.zip
chromium_src-779c33638f4b10def2d103f4703fa5bf58899aec.tar.gz
chromium_src-779c33638f4b10def2d103f4703fa5bf58899aec.tar.bz2
A few fixes for the HostZoomMap:
* Persist changes from Incognito (per UI leads) * Clear the zoom settings when the user does "reset to defaults" in prefs BUG=none TEST=Open incognito, change a zoom level, restart, see that it's persisted Review URL: http://codereview.chromium.org/551213 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_zoom_map.cc')
-rw-r--r--chrome/browser/host_zoom_map.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc
index 2c6393ca..88afb92 100644
--- a/chrome/browser/host_zoom_map.cc
+++ b/chrome/browser/host_zoom_map.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,19 +51,23 @@ void HostZoomMap::SetZoomLevel(const std::string& host, int level) {
host_zoom_levels_[host] = level;
}
- // Persist new zoom level if we're not off the record.
- if (!profile_->IsOffTheRecord()) {
- DictionaryValue* host_zoom_dictionary =
- profile_->GetPrefs()->GetMutableDictionary(prefs::kPerHostZoomLevels);
- std::wstring wide_host(UTF8ToWide(host));
- if (level == 0) {
- host_zoom_dictionary->RemoveWithoutPathExpansion(wide_host, NULL);
- } else {
- host_zoom_dictionary->SetWithoutPathExpansion(wide_host,
- Value::CreateIntegerValue(level));
- }
+ DictionaryValue* host_zoom_dictionary =
+ profile_->GetPrefs()->GetMutableDictionary(prefs::kPerHostZoomLevels);
+ std::wstring wide_host(UTF8ToWide(host));
+ if (level == 0) {
+ host_zoom_dictionary->RemoveWithoutPathExpansion(wide_host, NULL);
+ } else {
+ host_zoom_dictionary->SetWithoutPathExpansion(wide_host,
+ Value::CreateIntegerValue(level));
}
}
+void HostZoomMap::ResetToDefaults() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+
+ host_zoom_levels_.clear();
+ profile_->GetPrefs()->ClearPref(prefs::kPerHostZoomLevels);
+}
+
HostZoomMap::~HostZoomMap() {
}