#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/network/mojo_key_network_delegate.h"
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "chrome/browser/enterprise/connectors/device_trust/common/device_trust_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "net/http/http_response_headers.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/gurl.h"
namespace enterprise_connectors {
namespace {
constexpr int kMaxRetryCount = …;
std::unique_ptr<network::SimpleURLLoader> CreateURLLoader(
const GURL& url,
const std::string& dm_token,
const std::string& body) { … }
void LogNetError(int net_error) { … }
}
MojoKeyNetworkDelegate::MojoKeyNetworkDelegate(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory)
: … { … }
MojoKeyNetworkDelegate::~MojoKeyNetworkDelegate() = default;
void MojoKeyNetworkDelegate::SendPublicKeyToDmServer(
const GURL& url,
const std::string& dm_token,
const std::string& body,
UploadKeyCompletedCallback upload_key_completed_callback) { … }
void MojoKeyNetworkDelegate::OnURLLoaderComplete(
std::unique_ptr<network::SimpleURLLoader> url_loader,
UploadKeyCompletedCallback upload_key_completed_callback,
scoped_refptr<net::HttpResponseHeaders> headers) { … }
}