| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 Source<Profile>(profile_), | 120 Source<Profile>(profile_), |
| 121 NotificationService::NoDetails()); | 121 NotificationService::NoDetails()); |
| 122 | 122 |
| 123 // If we're in incognito mode, don't persist changes to the prefs. We'll keep | 123 // If we're in incognito mode, don't persist changes to the prefs. We'll keep |
| 124 // them in memory only so they will be forgotten on exiting incognito. | 124 // them in memory only so they will be forgotten on exiting incognito. |
| 125 if (profile_->IsOffTheRecord()) | 125 if (profile_->IsOffTheRecord()) |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 updating_preferences_ = true; | 128 updating_preferences_ = true; |
| 129 { | 129 { |
| 130 ScopedUserPrefUpdate update(profile_->GetPrefs(), | 130 DictionaryPrefUpdate update(profile_->GetPrefs(), |
| 131 prefs::kPerHostZoomLevels); | 131 prefs::kPerHostZoomLevels); |
| 132 DictionaryValue* host_zoom_dictionary = | 132 DictionaryValue* host_zoom_dictionary = update.Get(); |
| 133 profile_->GetPrefs()->GetMutableDictionary(prefs::kPerHostZoomLevels); | |
| 134 if (level == default_zoom_level_) { | 133 if (level == default_zoom_level_) { |
| 135 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); | 134 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); |
| 136 } else { | 135 } else { |
| 137 host_zoom_dictionary->SetWithoutPathExpansion( | 136 host_zoom_dictionary->SetWithoutPathExpansion( |
| 138 host, Value::CreateDoubleValue(level)); | 137 host, Value::CreateDoubleValue(level)); |
| 139 } | 138 } |
| 140 } | 139 } |
| 141 updating_preferences_ = false; | 140 updating_preferences_ = false; |
| 142 } | 141 } |
| 143 | 142 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 break; | 252 break; |
| 254 } | 253 } |
| 255 default: | 254 default: |
| 256 NOTREACHED() << "Unexpected preference observed."; | 255 NOTREACHED() << "Unexpected preference observed."; |
| 257 } | 256 } |
| 258 } | 257 } |
| 259 | 258 |
| 260 HostZoomMap::~HostZoomMap() { | 259 HostZoomMap::~HostZoomMap() { |
| 261 Shutdown(); | 260 Shutdown(); |
| 262 } | 261 } |
| OLD | NEW |