Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame^] | 1 | // Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BUFFET_UTILS_H_ |
| 6 | #define BUFFET_UTILS_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | #include <base/values.h> |
| 11 | #include <base/files/file_path.h> |
| 12 | #include <chromeos/errors/error.h> |
| 13 | |
| 14 | namespace buffet { |
| 15 | |
| 16 | extern const char kErrorDomainBuffet[]; |
| 17 | extern const char kFileReadError[]; |
| 18 | |
| 19 | // Helper function to load a JSON file that is expected to be |
| 20 | // an object/dictionary. In case of error, returns empty unique ptr and fills |
| 21 | // in error details in |error|. |
| 22 | std::unique_ptr<const base::DictionaryValue> LoadJsonDict( |
| 23 | const base::FilePath& json_file_path, chromeos::ErrorPtr* error); |
| 24 | |
| 25 | } // namespace buffet |
| 26 | |
| 27 | #endif // BUFFET_UTILS_H_ |