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

Side by Side Diff: chrome/common/json_pref_store.cc

Issue 7342043: Fixed regression: various preferences were not persisted when changed from incognito window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 5 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') | chrome/common/pref_names.cc » ('j') | 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 "chrome/common/json_pref_store.h" 5 #include "chrome/common/json_pref_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 JsonPrefStore::~JsonPrefStore() { 150 JsonPrefStore::~JsonPrefStore() {
151 CommitPendingWrite(); 151 CommitPendingWrite();
152 } 152 }
153 153
154 PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key, 154 PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key,
155 const Value** result) const { 155 const Value** result) const {
156 Value* tmp = NULL; 156 Value* tmp = NULL;
157 if (prefs_->Get(key, &tmp)) { 157 if (prefs_->Get(key, &tmp)) {
158 *result = tmp; 158 if (result)
159 *result = tmp;
159 return READ_OK; 160 return READ_OK;
160 } 161 }
161 return READ_NO_VALUE; 162 return READ_NO_VALUE;
162 } 163 }
163 164
164 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { 165 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) {
165 observers_.AddObserver(observer); 166 observers_.AddObserver(observer);
166 } 167 }
167 168
168 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { 169 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 311 }
311 312
312 bool JsonPrefStore::SerializeData(std::string* output) { 313 bool JsonPrefStore::SerializeData(std::string* output) {
313 // TODO(tc): Do we want to prune webkit preferences that match the default 314 // TODO(tc): Do we want to prune webkit preferences that match the default
314 // value? 315 // value?
315 JSONStringValueSerializer serializer(output); 316 JSONStringValueSerializer serializer(output);
316 serializer.set_pretty_print(true); 317 serializer.set_pretty_print(true);
317 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); 318 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren());
318 return serializer.Serialize(*(copy.get())); 319 return serializer.Serialize(*(copy.get()));
319 } 320 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/common/pref_names.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698