#include "components/policy/core/common/cloud/component_cloud_policy_store.h"
#include <stddef.h>
#include <stdint.h>
#include <string_view>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/json_reader.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/values.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "components/policy/core/common/cloud/resource_cache.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_logger.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_proto_decoders.h"
#include "components/policy/proto/chrome_extension_policy.pb.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "crypto/sha2.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "url/gurl.h"
em;
namespace policy {
struct ComponentCloudPolicyStore::DomainConstants { … };
namespace {
const ComponentCloudPolicyStore::DomainConstants kDomains[] = …;
const ComponentCloudPolicyStore::DomainConstants* GetDomainConstantsForType(
const std::string& type) { … }
}
ComponentCloudPolicyStore::Delegate::~Delegate() = default;
ComponentCloudPolicyStore::ComponentCloudPolicyStore(
Delegate* delegate,
ResourceCache* cache,
const std::string& policy_type)
: … { … }
ComponentCloudPolicyStore::~ComponentCloudPolicyStore() { … }
bool ComponentCloudPolicyStore::SupportsDomain(PolicyDomain domain) { … }
bool ComponentCloudPolicyStore::GetPolicyDomain(const std::string& policy_type,
PolicyDomain* domain) { … }
const std::string& ComponentCloudPolicyStore::GetCachedHash(
const PolicyNamespace& ns) const { … }
void ComponentCloudPolicyStore::SetCredentials(const std::string& username,
const std::string& gaia_id,
const std::string& dm_token,
const std::string& device_id,
const std::string& public_key,
int public_key_version) { … }
void ComponentCloudPolicyStore::Load() { … }
bool ComponentCloudPolicyStore::Store(const PolicyNamespace& ns,
const std::string& serialized_policy,
const em::PolicyData* policy_data,
const std::string& secure_hash,
const std::string& data) { … }
void ComponentCloudPolicyStore::Delete(const PolicyNamespace& ns) { … }
void ComponentCloudPolicyStore::Purge(const PurgeFilter& filter) { … }
void ComponentCloudPolicyStore::Clear() { … }
bool ComponentCloudPolicyStore::ValidatePolicy(
const PolicyNamespace& ns,
std::unique_ptr<em::PolicyFetchResponse> proto,
em::PolicyData* policy_data,
em::ExternalPolicyData* payload,
std::string* error) { … }
bool ComponentCloudPolicyStore::ValidateData(const std::string& data,
const std::string& secure_hash,
PolicyMap* policy,
std::string* error) { … }
bool ComponentCloudPolicyStore::ParsePolicy(const std::string& data,
PolicyMap* policy,
std::string* error) { … }
}