chromium/components/policy/core/browser/policy_conversions.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_
#define COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_

#include <memory>
#include <string>

#include "base/containers/flat_map.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/schema.h"
#include "components/policy/policy_export.h"
#include "extensions/buildflags/buildflags.h"
#include "ui/base/webui/web_ui_util.h"

namespace policy {

class PolicyConversionsClient;

extern const POLICY_EXPORT webui::LocalizedString
    kPolicySources[POLICY_SOURCE_COUNT];

extern const POLICY_EXPORT char kIdKey[];
extern const POLICY_EXPORT char kNameKey[];
extern const POLICY_EXPORT char kPoliciesKey[];
extern const POLICY_EXPORT char kPolicyNamesKey[];
extern const POLICY_EXPORT char kChromePoliciesId[];
extern const POLICY_EXPORT char kChromePoliciesName[];

#if !BUILDFLAG(IS_CHROMEOS)
extern const POLICY_EXPORT char kPrecedencePoliciesId[];
extern const POLICY_EXPORT char kPrecedencePoliciesName[];
#endif  // !BUILDFLAG(IS_CHROMEOS)

// A convenience class to retrieve all policies values.
// Usage example:
// PolicyConversions
//    .EnableConvertTypes(false)     // Using enable* functions to turn on/off
//    .EnableConvertValues(false)    // some features. All enable* functions are
//    .EnableConvertValues(true)     // optional.
//    .UseChromePolicyConversions()  // Choose different delegate if needed.
//    .ToValueDict();                // Choose the data format in the end.
class POLICY_EXPORT PolicyConversions {};

// Used to export all policies.
class POLICY_EXPORT DefaultPolicyConversions
    : public PolicyConversions::Delegate {};

// Used to export all Chrome policies. It also splits precedence
// policies into a different section.
class POLICY_EXPORT ChromePolicyConversions
    : public PolicyConversions::Delegate {};

}  // namespace policy

#endif  // COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_