| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/json/json_value_serializer.h" | 12 #include "base/json/json_file_value_serializer.h" |
| 13 #include "base/json/json_string_value_serializer.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop_proxy.h" | 15 #include "base/message_loop_proxy.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // Some extensions we'll tack on to copies of the Preferences files. | 20 // Some extensions we'll tack on to copies of the Preferences files. |
| 20 const FilePath::CharType* kBadExtension = FILE_PATH_LITERAL("bad"); | 21 const FilePath::CharType* kBadExtension = FILE_PATH_LITERAL("bad"); |
| 21 | 22 |
| 22 // Differentiates file loading between origin thread and passed | 23 // Differentiates file loading between origin thread and passed |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 299 } |
| 299 | 300 |
| 300 bool JsonPrefStore::SerializeData(std::string* output) { | 301 bool JsonPrefStore::SerializeData(std::string* output) { |
| 301 // TODO(tc): Do we want to prune webkit preferences that match the default | 302 // TODO(tc): Do we want to prune webkit preferences that match the default |
| 302 // value? | 303 // value? |
| 303 JSONStringValueSerializer serializer(output); | 304 JSONStringValueSerializer serializer(output); |
| 304 serializer.set_pretty_print(true); | 305 serializer.set_pretty_print(true); |
| 305 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); | 306 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); |
| 306 return serializer.Serialize(*(copy.get())); | 307 return serializer.Serialize(*(copy.get())); |
| 307 } | 308 } |
| OLD | NEW |