| 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 #ifndef BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 5 #ifndef BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
| 6 #define BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 6 #define BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 ~JSONFileValueDeserializer() override; | 54 ~JSONFileValueDeserializer() override; |
| 55 | 55 |
| 56 // Attempt to deserialize the data structure encoded in the file passed | 56 // Attempt to deserialize the data structure encoded in the file passed |
| 57 // in to the constructor into a structure of Value objects. If the return | 57 // in to the constructor into a structure of Value objects. If the return |
| 58 // value is NULL, and if |error_code| is non-null, |error_code| will | 58 // value is NULL, and if |error_code| is non-null, |error_code| will |
| 59 // contain an integer error code (either JsonFileError or JsonParseError). | 59 // contain an integer error code (either JsonFileError or JsonParseError). |
| 60 // If |error_message| is non-null, it will be filled in with a formatted | 60 // If |error_message| is non-null, it will be filled in with a formatted |
| 61 // error message including the location of the error if appropriate. | 61 // error message including the location of the error if appropriate. |
| 62 // The caller takes ownership of the returned value. | 62 // The caller takes ownership of the returned value. |
| 63 scoped_ptr<base::Value> Deserialize(int* error_code, | 63 std::unique_ptr<base::Value> Deserialize(int* error_code, |
| 64 std::string* error_message) override; | 64 std::string* error_message) override; |
| 65 | 65 |
| 66 // This enum is designed to safely overlap with JSONReader::JsonParseError. | 66 // This enum is designed to safely overlap with JSONReader::JsonParseError. |
| 67 enum JsonFileError { | 67 enum JsonFileError { |
| 68 JSON_NO_ERROR = 0, | 68 JSON_NO_ERROR = 0, |
| 69 JSON_ACCESS_DENIED = 1000, | 69 JSON_ACCESS_DENIED = 1000, |
| 70 JSON_CANNOT_READ_FILE, | 70 JSON_CANNOT_READ_FILE, |
| 71 JSON_FILE_LOCKED, | 71 JSON_FILE_LOCKED, |
| 72 JSON_NO_SUCH_FILE | 72 JSON_NO_SUCH_FILE |
| 73 }; | 73 }; |
| 74 | 74 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 97 | 97 |
| 98 const base::FilePath json_file_path_; | 98 const base::FilePath json_file_path_; |
| 99 bool allow_trailing_comma_; | 99 bool allow_trailing_comma_; |
| 100 size_t last_read_size_; | 100 size_t last_read_size_; |
| 101 | 101 |
| 102 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueDeserializer); | 102 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueDeserializer); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 #endif // BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 105 #endif // BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
| 106 | 106 |
| OLD | NEW |