1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_
6 #define COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_
8 #include "base/values.h"
9 #include "third_party/abseil-cpp/absl/types/optional.h"
15 namespace fuchsia_component_support {
17 // Return a JSON dictionary read from the calling Component's config-data.
18 // All *.json files in the config-data directory are read, parsed, and merged
19 // into a single JSON dictionary value.
20 // Null is returned if no config-data exists for the Component.
21 // CHECK()s if one or more config files are malformed, or there are duplicate
22 // non-dictionary fields in different config files.
23 const absl::optional<base::Value::Dict>& LoadPackageConfig();
25 // Used to test the implementation of LoadPackageConfig().
26 absl::optional<base::Value::Dict> LoadConfigFromDirForTest(
27 const base::FilePath& dir);
29 } // namespace fuchsia_component_support
31 #endif // COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_