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 | |
Alex Vakulenko | 07216fe | 2014-09-19 15:31:09 -0700 | [diff] [blame] | 16 | // Buffet-wide errors. |
| 17 | // TODO(avakulenko): This should be consolidated into errors::<domain> namespace |
| 18 | // See crbug.com/417274 |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 19 | extern const char kErrorDomainBuffet[]; |
| 20 | extern const char kFileReadError[]; |
Alex Vakulenko | 07216fe | 2014-09-19 15:31:09 -0700 | [diff] [blame] | 21 | extern const char kInvalidCategoryError[]; |
| 22 | extern const char kInvalidPackageError[]; |
| 23 | |
| 24 | // kDefaultCategory represents a default state property category for standard |
| 25 | // properties from "base" package which are provided by buffet and not any of |
| 26 | // the daemons running on the device. |
| 27 | const char kDefaultCategory[] = ""; |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 28 | |
| 29 | // Helper function to load a JSON file that is expected to be |
| 30 | // an object/dictionary. In case of error, returns empty unique ptr and fills |
| 31 | // in error details in |error|. |
| 32 | std::unique_ptr<const base::DictionaryValue> LoadJsonDict( |
| 33 | const base::FilePath& json_file_path, chromeos::ErrorPtr* error); |
| 34 | |
| 35 | } // namespace buffet |
| 36 | |
| 37 | #endif // BUFFET_UTILS_H_ |