chromium/components/policy/core/browser/configuration_policy_handler.cc

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

#include "components/policy/core/browser/configuration_policy_handler.h"

#include <stddef.h>

#include <algorithm>
#include <string>
#include <utility>

#include "base/check.h"
#include "base/containers/adapters.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/schema.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_value_map.h"
#include "components/strings/grit/components_strings.h"
#include "url/gurl.h"

namespace policy {

const size_t kMaxUrlFiltersPerPolicy =;

// ConfigurationPolicyHandler implementation
// -----------------------------------

ConfigurationPolicyHandler::ConfigurationPolicyHandler() {}

ConfigurationPolicyHandler::~ConfigurationPolicyHandler() {}

void ConfigurationPolicyHandler::PrepareForDisplaying(
    PolicyMap* policies) const {}

void ConfigurationPolicyHandler::ApplyPolicySettingsWithParameters(
    const PolicyMap& policies,
    const PolicyHandlerParameters& parameters,
    PrefValueMap* prefs) {}

// NamedPolicyHandler implementation -------------------------------------------
NamedPolicyHandler::NamedPolicyHandler(const char* policy_name)
    :{}

NamedPolicyHandler::~NamedPolicyHandler() = default;

const char* NamedPolicyHandler::policy_name() const {}

// TypeCheckingPolicyHandler implementation ------------------------------------

TypeCheckingPolicyHandler::TypeCheckingPolicyHandler(
    const char* policy_name,
    base::Value::Type value_type)
    :{}

TypeCheckingPolicyHandler::~TypeCheckingPolicyHandler() {}

bool TypeCheckingPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
                                                    PolicyErrorMap* errors) {}

bool TypeCheckingPolicyHandler::CheckPolicySettings(
    const char* policy,
    base::Value::Type value_type,
    const PolicyMap::Entry* entry,
    PolicyErrorMap* errors) {}

bool TypeCheckingPolicyHandler::CheckAndGetValue(const PolicyMap& policies,
                                                 PolicyErrorMap* errors,
                                                 const base::Value** value) {}

bool TypeCheckingPolicyHandler::CheckAndGetValue(const char* policy,
                                                 base::Value::Type value_type,
                                                 const PolicyMap::Entry* entry,
                                                 PolicyErrorMap* errors,
                                                 const base::Value** value) {}

// StringListPolicyHandler implementation --------------------------------------

ListPolicyHandler::ListPolicyHandler(const char* policy_name,
                                     base::Value::Type list_entry_type)
    :{}

ListPolicyHandler::~ListPolicyHandler() {}

bool ListPolicyHandler::CheckPolicySettings(const policy::PolicyMap& policies,
                                            policy::PolicyErrorMap* errors) {}

void ListPolicyHandler::ApplyPolicySettings(const policy::PolicyMap& policies,
                                            PrefValueMap* prefs) {}

bool ListPolicyHandler::CheckAndGetList(
    const policy::PolicyMap& policies,
    policy::PolicyErrorMap* errors,
    std::optional<base::Value::List>& filtered_list) {}

bool ListPolicyHandler::CheckListEntry(const base::Value& value) {}

// IntRangePolicyHandlerBase implementation ------------------------------------

IntRangePolicyHandlerBase::IntRangePolicyHandlerBase(const char* policy_name,
                                                     int min,
                                                     int max,
                                                     bool clamp)
    :{}

bool IntRangePolicyHandlerBase::CheckPolicySettings(const PolicyMap& policies,
                                                    PolicyErrorMap* errors) {}

IntRangePolicyHandlerBase::~IntRangePolicyHandlerBase() {}

bool IntRangePolicyHandlerBase::EnsureInRange(const base::Value* input,
                                              int* output,
                                              PolicyErrorMap* errors) {}

// StringMappingListPolicyHandler implementation -----------------------------

StringMappingListPolicyHandler::MappingEntry::MappingEntry(
    const char* policy_value,
    std::unique_ptr<base::Value> map)
    :{}

StringMappingListPolicyHandler::MappingEntry::~MappingEntry() {}

StringMappingListPolicyHandler::StringMappingListPolicyHandler(
    const char* policy_name,
    const char* pref_path,
    const GenerateMapCallback& callback)
    :{}

StringMappingListPolicyHandler::~StringMappingListPolicyHandler() {}

bool StringMappingListPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

void StringMappingListPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {}

bool StringMappingListPolicyHandler::Convert(const base::Value* input,
                                             base::Value::List* output,
                                             PolicyErrorMap* errors) {}

std::unique_ptr<base::Value> StringMappingListPolicyHandler::Map(
    const std::string& entry_value) {}

// IntRangePolicyHandler implementation ----------------------------------------

IntRangePolicyHandler::IntRangePolicyHandler(const char* policy_name,
                                             const char* pref_path,
                                             int min,
                                             int max,
                                             bool clamp)
    :{}

IntRangePolicyHandler::~IntRangePolicyHandler() {}

void IntRangePolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
                                                PrefValueMap* prefs) {}

// IntPercentageToDoublePolicyHandler implementation ---------------------------

IntPercentageToDoublePolicyHandler::IntPercentageToDoublePolicyHandler(
    const char* policy_name,
    const char* pref_path,
    int min,
    int max,
    bool clamp)
    :{}

IntPercentageToDoublePolicyHandler::~IntPercentageToDoublePolicyHandler() {}

void IntPercentageToDoublePolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {}

// SimplePolicyHandler implementation ------------------------------------------

SimplePolicyHandler::SimplePolicyHandler(const char* policy_name,
                                         const char* pref_path,
                                         base::Value::Type value_type)
    :{}

SimplePolicyHandler::~SimplePolicyHandler() {}

void SimplePolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
                                              PrefValueMap* prefs) {}

// PolicyWithDependencyHandler implementation ------------------------------------------

PolicyWithDependencyHandler::PolicyWithDependencyHandler(
    const char* required_policy_name,
    DependencyRequirement dependency_requirement,
    base::Value expected_dependency_value,
    std::unique_ptr<NamedPolicyHandler> handler)
    :{}

PolicyWithDependencyHandler::~PolicyWithDependencyHandler() = default;

bool PolicyWithDependencyHandler::CheckPolicySettings(const PolicyMap& policies,
                                                      PolicyErrorMap* errors) {}

void PolicyWithDependencyHandler::ApplyPolicySettingsWithParameters(
    const policy::PolicyMap& policies,
    const policy::PolicyHandlerParameters& parameters,
    PrefValueMap* prefs) {}

void PolicyWithDependencyHandler::ApplyPolicySettings(
    const policy::PolicyMap& /* policies */,
    PrefValueMap* /* prefs */) {}
// SchemaValidatingPolicyHandler implementation --------------------------------

SchemaValidatingPolicyHandler::SchemaValidatingPolicyHandler(
    const char* policy_name,
    Schema schema,
    SchemaOnErrorStrategy strategy)
    :{}

SchemaValidatingPolicyHandler::~SchemaValidatingPolicyHandler() {}

bool SchemaValidatingPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

bool SchemaValidatingPolicyHandler::CheckAndGetValue(
    const PolicyMap& policies,
    PolicyErrorMap* errors,
    std::unique_ptr<base::Value>* output) {}

// SimpleSchemaValidatingPolicyHandler implementation --------------------------

SimpleSchemaValidatingPolicyHandler::SimpleSchemaValidatingPolicyHandler(
    const char* policy_name,
    const char* pref_path,
    Schema schema,
    SchemaOnErrorStrategy strategy,
    RecommendedPermission recommended_permission,
    MandatoryPermission mandatory_permission)
    :{}

SimpleSchemaValidatingPolicyHandler::~SimpleSchemaValidatingPolicyHandler() {}

bool SimpleSchemaValidatingPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

void SimpleSchemaValidatingPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {}

// SimpleJsonStringSchemaValidatingPolicyHandler implementation ----------------

SimpleJsonStringSchemaValidatingPolicyHandler::
    SimpleJsonStringSchemaValidatingPolicyHandler(
        const char* policy_name,
        const char* pref_path,
        Schema schema,
        SimpleSchemaValidatingPolicyHandler::RecommendedPermission
            recommended_permission,
        SimpleSchemaValidatingPolicyHandler::MandatoryPermission
            mandatory_permission)
    :{}

SimpleJsonStringSchemaValidatingPolicyHandler::
    ~SimpleJsonStringSchemaValidatingPolicyHandler() {}

bool SimpleJsonStringSchemaValidatingPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

bool SimpleJsonStringSchemaValidatingPolicyHandler::CheckSingleJsonString(
    const base::Value* root_value,
    PolicyErrorMap* errors) {}

bool SimpleJsonStringSchemaValidatingPolicyHandler::CheckListOfJsonStrings(
    const base::Value* root_value,
    PolicyErrorMap* errors) {}

bool SimpleJsonStringSchemaValidatingPolicyHandler::ValidateJsonString(
    const std::string& json_string,
    PolicyErrorMap* errors,
    int index) {}

void SimpleJsonStringSchemaValidatingPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {}

void SimpleJsonStringSchemaValidatingPolicyHandler::RecordJsonError() {}

bool SimpleJsonStringSchemaValidatingPolicyHandler::IsListSchema() const {}

// LegacyPoliciesDeprecatingPolicyHandler implementation -----------------------

LegacyPoliciesDeprecatingPolicyHandler::LegacyPoliciesDeprecatingPolicyHandler(
    std::vector<std::unique_ptr<ConfigurationPolicyHandler>>
        legacy_policy_handlers,
    std::unique_ptr<NamedPolicyHandler> new_policy_handler)
    :{}

LegacyPoliciesDeprecatingPolicyHandler::
    ~LegacyPoliciesDeprecatingPolicyHandler() {}

bool LegacyPoliciesDeprecatingPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

void LegacyPoliciesDeprecatingPolicyHandler::ApplyPolicySettingsWithParameters(
    const policy::PolicyMap& policies,
    const policy::PolicyHandlerParameters& parameters,
    PrefValueMap* prefs) {}

void LegacyPoliciesDeprecatingPolicyHandler::ApplyPolicySettings(
    const policy::PolicyMap& /* policies */,
    PrefValueMap* /* prefs */) {}

// SimpleDeprecatingPolicyHandler implementation -----------------------

SimpleDeprecatingPolicyHandler::SimpleDeprecatingPolicyHandler(
    std::unique_ptr<NamedPolicyHandler> legacy_policy_handler,
    std::unique_ptr<NamedPolicyHandler> new_policy_handler)
    :{}

SimpleDeprecatingPolicyHandler::~SimpleDeprecatingPolicyHandler() = default;

bool SimpleDeprecatingPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

void SimpleDeprecatingPolicyHandler::ApplyPolicySettingsWithParameters(
    const policy::PolicyMap& policies,
    const policy::PolicyHandlerParameters& parameters,
    PrefValueMap* prefs) {}

void SimpleDeprecatingPolicyHandler::ApplyPolicySettings(
    const policy::PolicyMap& /* policies */,
    PrefValueMap* /* prefs */) {}

// CloudOnlyPolicyHandler implementation ---------------------------------------

namespace {

bool IsCloudOnlyPolicy(const policy::PolicyMap::Entry& policy) {}

}  // namespace

CloudOnlyPolicyHandler::CloudOnlyPolicyHandler(const char* policy_name,
                                               Schema schema,
                                               SchemaOnErrorStrategy strategy)
    :{}

CloudOnlyPolicyHandler::~CloudOnlyPolicyHandler() = default;

// static
bool CloudOnlyPolicyHandler::CheckCloudOnlyPolicySettings(
    const char* policy_name,
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

bool CloudOnlyPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
                                                 PolicyErrorMap* errors) {}

// CloudUserOnlyPolicyHandler implementation
// ---------------------------------------

CloudUserOnlyPolicyHandler::CloudUserOnlyPolicyHandler(
    std::unique_ptr<NamedPolicyHandler> policy_handler)
    :{}

CloudUserOnlyPolicyHandler::~CloudUserOnlyPolicyHandler() = default;

// static
bool CloudUserOnlyPolicyHandler::CheckUserOnlyPolicySettings(
    const char* policy_name,
    const PolicyMap& policies,
    PolicyErrorMap* errors) {}

bool CloudUserOnlyPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
                                                     PolicyErrorMap* errors) {}

void CloudUserOnlyPolicyHandler::ApplyPolicySettingsWithParameters(
    const policy::PolicyMap& policies,
    const policy::PolicyHandlerParameters& parameters,
    PrefValueMap* prefs) {}

void CloudUserOnlyPolicyHandler::ApplyPolicySettings(
    const policy::PolicyMap& /* policies */,
    PrefValueMap* /* prefs */) {}

URLPolicyHandler::URLPolicyHandler(const char* policy_name,
                                   const char* pref_path)
    :{}

URLPolicyHandler::~URLPolicyHandler() = default;

bool URLPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
                                           PolicyErrorMap* errors) {}

}  // namespace policy