diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-06-22 09:53:13 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-06-22 10:23:17 +0000 |
commit | c5dbcb143405a38088d78b4b760d64aaff5157ab (patch) | |
tree | b37edca540b35f898e212bebfa6ded0806988122 /chromium/components/policy/core/common/cloud/policy_value_validator.h | |
parent | 774f54339e5db91f785733232d3950366db65d07 (diff) | |
download | qtwebengine-chromium-c5dbcb143405a38088d78b4b760d64aaff5157ab.tar.gz |
BASELINE: Update Chromium to 102.0.5005.137
Change-Id: I162cdc7f56760218868e000a4c8ea92573344036
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/policy/core/common/cloud/policy_value_validator.h')
-rw-r--r-- | chromium/components/policy/core/common/cloud/policy_value_validator.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chromium/components/policy/core/common/cloud/policy_value_validator.h b/chromium/components/policy/core/common/cloud/policy_value_validator.h new file mode 100644 index 00000000000..166cc257db0 --- /dev/null +++ b/chromium/components/policy/core/common/cloud/policy_value_validator.h @@ -0,0 +1,41 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_VALUE_VALIDATOR_H_ +#define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_VALUE_VALIDATOR_H_ + +#include <string> + +namespace policy { + +struct ValueValidationIssue { + enum Severity { kWarning, kError }; + + std::string policy_name; + Severity severity = kWarning; + std::string message; + + bool operator==(ValueValidationIssue const& rhs) const { + return policy_name == rhs.policy_name && severity == rhs.severity && + message == rhs.message; + } +}; + +template <typename PayloadProto> +class PolicyValueValidator { + public: + PolicyValueValidator() = default; + PolicyValueValidator(const PolicyValueValidator&) = delete; + PolicyValueValidator& operator=(const PolicyValueValidator&) = delete; + virtual ~PolicyValueValidator() = default; + + // Returns false if the value validation failed with errors. + virtual bool ValidateValues( + const PayloadProto& policy_payload, + std::vector<ValueValidationIssue>* out_validation_issues) const = 0; +}; + +} // namespace policy + +#endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_VALUE_VALIDATOR_H_ |