config_reader.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2020 The Chromium 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. #ifndef COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_
  5. #define COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_
  6. #include "base/values.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace base {
  9. class FilePath;
  10. }
  11. namespace fuchsia_component_support {
  12. // Return a JSON dictionary read from the calling Component's config-data.
  13. // All *.json files in the config-data directory are read, parsed, and merged
  14. // into a single JSON dictionary value.
  15. // Null is returned if no config-data exists for the Component.
  16. // CHECK()s if one or more config files are malformed, or there are duplicate
  17. // non-dictionary fields in different config files.
  18. const absl::optional<base::Value>& LoadPackageConfig();
  19. // Used to test the implementation of LoadPackageConfig().
  20. absl::optional<base::Value> LoadConfigFromDirForTest(const base::FilePath& dir);
  21. } // namespace fuchsia_component_support
  22. #endif // COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_CONFIG_READER_H_