| 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 "base/json/json_string_value_serializer.h" | 5 #include "base/json/json_string_value_serializer.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 base::JSONWriter::WriteWithOptions(&root, options, json_string_); | 33 base::JSONWriter::WriteWithOptions(&root, options, json_string_); |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 Value* JSONStringValueSerializer::Deserialize(int* error_code, | 37 Value* JSONStringValueSerializer::Deserialize(int* error_code, |
| 38 std::string* error_str) { | 38 std::string* error_str) { |
| 39 if (!json_string_) | 39 if (!json_string_) |
| 40 return NULL; | 40 return NULL; |
| 41 | 41 |
| 42 return base::JSONReader::ReadAndReturnError(*json_string_, | 42 return base::JSONReader::ReadAndReturnError(*json_string_, |
| 43 allow_trailing_comma_, | 43 allow_trailing_comma_ ? base::JSON_ALLOW_TRAILING_COMMAS : |
| 44 error_code, | 44 base::JSON_PARSE_RFC, |
| 45 error_str); | 45 error_code, error_str); |
| 46 } | 46 } |
| OLD | NEW |