#include "chrome/enterprise_companion/dm_client.h"
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "chrome/enterprise_companion/device_management_storage/dm_storage.h"
#include "chrome/enterprise_companion/enterprise_companion_branding.h"
#include "chrome/enterprise_companion/enterprise_companion_status.h"
#include "chrome/enterprise_companion/enterprise_companion_version.h"
#include "chrome/enterprise_companion/event_logger.h"
#include "chrome/enterprise_companion/global_constants.h"
#include "components/policy/core/common/cloud/client_data_delegate.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_util.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace enterprise_companion {
namespace {
template <typename... Args>
base::OnceCallback<void(Args...)> TeeOnceCallback(
base::OnceCallback<void(Args...)> a,
base::OnceCallback<void(Args...)> b) { … }
device_management_storage::DMPolicyMap ToDMPolicyMap(
const policy::CloudPolicyClient::ResponseMap& in) { … }
class DMConfiguration : public policy::DeviceManagementService::Configuration { … };
class ClientDataDelegate : public policy::ClientDataDelegate { … };
class FetchedPolicyValidator final : public policy::CloudPolicyValidatorBase { … };
class DMClientImpl : public DMClient, policy::CloudPolicyClient::Observer { … };
}
CloudPolicyClientProvider GetDefaultCloudPolicyClientProvider(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) { … }
PolicyFetchResponseValidator GetDefaultPolicyFetchResponseValidator() { … }
std::unique_ptr<policy::DeviceManagementService::Configuration>
CreateDeviceManagementServiceConfig() { … }
std::unique_ptr<DMClient> CreateDMClient(
CloudPolicyClientProvider cloud_policy_client_provider,
scoped_refptr<device_management_storage::DMStorage> dm_storage,
PolicyFetchResponseValidator policy_fetch_response_validator,
std::unique_ptr<policy::DeviceManagementService::Configuration> config) { … }
}