#include "chrome/browser/policy/messaging_layer/public/report_client.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/sequence_bound.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/policy/messaging_layer/storage_selector/storage_selector.h"
#include "chrome/browser/policy/messaging_layer/util/dm_token_retriever_provider.h"
#include "chrome/browser/policy/messaging_layer/util/reporting_server_connector.h"
#include "chrome/common/chrome_paths.h"
#include "components/reporting/client/dm_token_retriever.h"
#include "components/reporting/client/report_queue_configuration.h"
#include "components/reporting/storage/storage_module_interface.h"
#include "components/reporting/util/reporting_errors.h"
#include "components/reporting/util/status.h"
#include "components/reporting/util/statusor.h"
#if !BUILDFLAG(IS_CHROMEOS)
#include "base/task/bind_post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/policy/messaging_layer/upload/upload_provider.h"
#include "components/reporting/encryption/verification.h"
#endif
namespace reporting {
#if !BUILDFLAG(IS_CHROMEOS)
namespace {
const base::FilePath::CharType kReportingDirectory[] = …);
}
#endif
ReportingClient::ReportingClient(
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner)
: … { … }
ReportingClient::~ReportingClient() { … }
void ReportingClient::OnConnected() { … }
void ReportingClient::OnDisconnected() { … }
ReportQueueProvider::SmartPtr<ReportingClient> ReportingClient::Create(
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner) { … }
void ReportingClient::ConfigureReportQueue(
std::unique_ptr<ReportQueueConfiguration> configuration,
ReportQueueProvider::ReportQueueConfiguredCallback completion_cb) { … }
#if !BUILDFLAG(IS_CHROMEOS)
class ReportingClient::Uploader : public UploaderInterface { … };
ReportingClient::Uploader::Helper::Helper(
bool need_encryption_key,
ReportingClient::Uploader::UploadCallback upload_callback)
: … { … }
void ReportingClient::Uploader::Helper::ProcessRecord(
EncryptedRecord data,
ScopedReservation scoped_reservation,
base::OnceCallback<void(bool)> processed_cb) { … }
void ReportingClient::Uploader::Helper::ProcessGap(
SequenceInformation start,
uint64_t count,
base::OnceCallback<void(bool)> processed_cb) { … }
void ReportingClient::Uploader::Helper::Completed(Status final_status) { … }
std::unique_ptr<EncryptedReportingUploadProvider>
ReportingClient::CreateLocalUploadProvider(
scoped_refptr<StorageModuleInterface> storage_module) { … }
void ReportingClient::AsyncStartUploader(
base::WeakPtr<ReportQueueProvider> instance,
UploaderInterface::UploadReason reason,
UploaderInterface::UploaderInterfaceResultCb start_uploader_cb) { … }
void ReportingClient::DeliverAsyncStartUploader(
UploaderInterface::UploadReason reason,
UploaderInterface::UploaderInterfaceResultCb start_uploader_cb) { … }
#endif
}