chromium/components/safe_browsing/core/common/safe_browsing_policy_handler.cc

// Copyright 2020 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/safe_browsing/core/common/safe_browsing_policy_handler.h"

#include <optional>

#include "base/strings/string_number_conversions.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/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_value_map.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/strings/grit/components_strings.h"

namespace safe_browsing {

namespace {

ProtectionLevel;

// The result of checking a policy value.
enum class PolicyCheckResult {};

// Checks the value of the SafeBrowsingEnabled policy. |errors| may be
// nullptr.
PolicyCheckResult CheckSafeBrowsingEnabled(
    const base::Value* safe_browsing_enabled,
    policy::PolicyErrorMap* errors) {}

// Returns the target value of the Safe Browsing Protection Level derived only
// from the legacy SafeBrowsingEnabled policy. If this policy is not set or
// does not have a valid value, returns |nullopt|.
std::optional<ProtectionLevel> GetValueFromSafeBrowsingEnabledPolicy(
    const policy::PolicyMap& policies) {}

// Returns true if |value| is within the valid range of the
// SafeBrowsingProtectionLevel enum policy.
bool IsValidSafeBrowsingProtectionLevelValue(int value) {}

// Checks the value of the SafeBrowsingProtectionLevel policy. |errors| may be
// nullptr.
PolicyCheckResult CheckSafeBrowsingProtectionLevel(
    const base::Value* safe_browsing_protection_level,
    policy::PolicyErrorMap* errors) {}

// Returns the target value of Safe Browsing protection level derived only
// from the SafeBrowsingProtectionLevel policy. If this policy is not set or
// does not have a valid value, returns |nullopt|.
std::optional<ProtectionLevel> GetValueFromSafeBrowsingProtectionLevelPolicy(
    const policy::PolicyMap& policies) {}

// Returns the target value of Safe Browsing protection level, derived from
// both the SafeBrowsingEnabled policy and the
// SafeBrowsingProtectionLevel policy. If both policies are set,
// SafeBrowsingProtectionLevel wins.
std::optional<ProtectionLevel> GetValueFromBothPolicies(
    const policy::PolicyMap& policies) {}

}  // namespace

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

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

// static
SafeBrowsingPolicyHandler::ProtectionLevel
SafeBrowsingPolicyHandler::GetSafeBrowsingProtectionLevel(
    const PrefService* pref_sevice) {}

// static
bool SafeBrowsingPolicyHandler::IsSafeBrowsingProtectionLevelSetByPolicy(
    const PrefService* pref_service) {}

}  // namespace safe_browsing