policy_namespace_mojom_traits.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2022 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 CHROMEOS_CROSAPI_MOJOM_POLICY_NAMESPACE_MOJOM_TRAITS_H_
  5. #define CHROMEOS_CROSAPI_MOJOM_POLICY_NAMESPACE_MOJOM_TRAITS_H_
  6. #include "base/component_export.h"
  7. #include "chromeos/crosapi/mojom/policy_namespace.mojom-shared.h"
  8. #include "components/policy/core/common/policy_namespace.h"
  9. namespace mojo {
  10. template <>
  11. struct COMPONENT_EXPORT(MOJO_BASE_SHARED_TRAITS)
  12. StructTraits<crosapi::mojom::PolicyNamespaceDataView,
  13. policy::PolicyNamespace> {
  14. static policy::PolicyDomain domain(const policy::PolicyNamespace& ns) {
  15. return ns.domain;
  16. }
  17. static const std::string& component_id(const policy::PolicyNamespace& ns) {
  18. return ns.component_id;
  19. }
  20. static bool Read(crosapi::mojom::PolicyNamespaceDataView data,
  21. policy::PolicyNamespace* out);
  22. };
  23. } // namespace mojo
  24. #endif // CHROMEOS_CROSAPI_MOJOM_POLICY_NAMESPACE_MOJOM_TRAITS_H_