#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;
enum class PolicyCheckResult { … };
PolicyCheckResult CheckSafeBrowsingEnabled(
const base::Value* safe_browsing_enabled,
policy::PolicyErrorMap* errors) { … }
std::optional<ProtectionLevel> GetValueFromSafeBrowsingEnabledPolicy(
const policy::PolicyMap& policies) { … }
bool IsValidSafeBrowsingProtectionLevelValue(int value) { … }
PolicyCheckResult CheckSafeBrowsingProtectionLevel(
const base::Value* safe_browsing_protection_level,
policy::PolicyErrorMap* errors) { … }
std::optional<ProtectionLevel> GetValueFromSafeBrowsingProtectionLevelPolicy(
const policy::PolicyMap& policies) { … }
std::optional<ProtectionLevel> GetValueFromBothPolicies(
const policy::PolicyMap& policies) { … }
}
bool SafeBrowsingPolicyHandler::CheckPolicySettings(
const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors) { … }
void SafeBrowsingPolicyHandler::ApplyPolicySettings(
const policy::PolicyMap& policies,
PrefValueMap* prefs) { … }
SafeBrowsingPolicyHandler::ProtectionLevel
SafeBrowsingPolicyHandler::GetSafeBrowsingProtectionLevel(
const PrefService* pref_sevice) { … }
bool SafeBrowsingPolicyHandler::IsSafeBrowsingProtectionLevelSetByPolicy(
const PrefService* pref_service) { … }
}