blob: a776e0c150faf9a3b5c6e1414de5d7650a514889 [file] [log] [blame]
Alex Vakulenkob04936f2014-09-19 14:53:58 -07001// 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
14namespace buffet {
15
Alex Vakulenko07216fe2014-09-19 15:31:09 -070016// Buffet-wide errors.
17// TODO(avakulenko): This should be consolidated into errors::<domain> namespace
18// See crbug.com/417274
Alex Vakulenkob04936f2014-09-19 14:53:58 -070019extern const char kErrorDomainBuffet[];
20extern const char kFileReadError[];
Alex Vakulenko07216fe2014-09-19 15:31:09 -070021extern const char kInvalidCategoryError[];
22extern 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.
27const char kDefaultCategory[] = "";
Alex Vakulenkob04936f2014-09-19 14:53:58 -070028
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|.
32std::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_