| 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" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 static void HandleErrors(const Value* value, | 74 static void HandleErrors(const Value* value, |
| 75 const FilePath& path, | 75 const FilePath& path, |
| 76 int error_code, | 76 int error_code, |
| 77 const std::string& error_msg, | 77 const std::string& error_msg, |
| 78 PersistentPrefStore::PrefReadError* error); | 78 PersistentPrefStore::PrefReadError* error); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 friend class base::RefCountedThreadSafe<FileThreadDeserializer>; | 81 friend class base::RefCountedThreadSafe<FileThreadDeserializer>; |
| 82 ~FileThreadDeserializer() {} |
| 82 | 83 |
| 83 bool no_dir_; | 84 bool no_dir_; |
| 84 PersistentPrefStore::PrefReadError error_; | 85 PersistentPrefStore::PrefReadError error_; |
| 85 scoped_ptr<Value> value_; | 86 scoped_ptr<Value> value_; |
| 86 scoped_refptr<JsonPrefStore> delegate_; | 87 scoped_refptr<JsonPrefStore> delegate_; |
| 87 scoped_refptr<base::MessageLoopProxy> file_loop_proxy_; | 88 scoped_refptr<base::MessageLoopProxy> file_loop_proxy_; |
| 88 scoped_refptr<base::MessageLoopProxy> origin_loop_proxy_; | 89 scoped_refptr<base::MessageLoopProxy> origin_loop_proxy_; |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 // static | 92 // static |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 306 } |
| 306 | 307 |
| 307 bool JsonPrefStore::SerializeData(std::string* output) { | 308 bool JsonPrefStore::SerializeData(std::string* output) { |
| 308 // TODO(tc): Do we want to prune webkit preferences that match the default | 309 // TODO(tc): Do we want to prune webkit preferences that match the default |
| 309 // value? | 310 // value? |
| 310 JSONStringValueSerializer serializer(output); | 311 JSONStringValueSerializer serializer(output); |
| 311 serializer.set_pretty_print(true); | 312 serializer.set_pretty_print(true); |
| 312 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); | 313 scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); |
| 313 return serializer.Serialize(*(copy.get())); | 314 return serializer.Serialize(*(copy.get())); |
| 314 } | 315 } |
| OLD | NEW |