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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 JSONStringValueDeserializer::JSONStringValueDeserializer( | 43 JSONStringValueDeserializer::JSONStringValueDeserializer( |
44 const base::StringPiece& json_string) | 44 const base::StringPiece& json_string) |
45 : json_string_(json_string), | 45 : json_string_(json_string), |
46 allow_trailing_comma_(false) { | 46 allow_trailing_comma_(false) { |
47 } | 47 } |
48 | 48 |
49 JSONStringValueDeserializer::~JSONStringValueDeserializer() {} | 49 JSONStringValueDeserializer::~JSONStringValueDeserializer() {} |
50 | 50 |
51 scoped_ptr<Value> JSONStringValueDeserializer::Deserialize( | 51 std::unique_ptr<Value> JSONStringValueDeserializer::Deserialize( |
52 int* error_code, | 52 int* error_code, |
53 std::string* error_str) { | 53 std::string* error_str) { |
54 return base::JSONReader::ReadAndReturnError( | 54 return base::JSONReader::ReadAndReturnError( |
55 json_string_, allow_trailing_comma_ ? base::JSON_ALLOW_TRAILING_COMMAS | 55 json_string_, allow_trailing_comma_ ? base::JSON_ALLOW_TRAILING_COMMAS |
56 : base::JSON_PARSE_RFC, | 56 : base::JSON_PARSE_RFC, |
57 error_code, error_str); | 57 error_code, error_str); |
58 } | 58 } |
OLD | NEW |