#ifndef COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_STATS_H_
#define COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_STATS_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <vector>
#include "base/functional/callback.h"
#include "build/build_config.h"
#include "components/download/public/common/download_content.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_export.h"
#include "components/download/public/common/download_interrupt_reasons.h"
#include "components/download/public/common/download_source.h"
#include "mojo/public/c/system/types.h"
#include "net/base/network_change_notifier.h"
#include "url/gurl.h"
namespace base {
class FilePath;
class Time;
class TimeDelta;
}
namespace download {
enum DownloadCountTypes { … };
enum class DownloadLaterEvent { … };
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadCount(DownloadCountTypes type);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadCountWithSource(
DownloadCountTypes type,
DownloadSource download_source);
COMPONENTS_DOWNLOAD_EXPORT void RecordNewDownloadStarted(
net::NetworkChangeNotifier::ConnectionType connection_type,
DownloadSource download_source);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadCompleted(
int64_t download_len,
bool is_parallelizable,
net::NetworkChangeNotifier::ConnectionType connection_type,
DownloadSource download_source);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadInterrupted(
DownloadInterruptReason reason,
int64_t received,
int64_t total,
bool is_parallelizable,
bool is_parallel_download_enabled,
DownloadSource download_source);
COMPONENTS_DOWNLOAD_EXPORT void RecordDangerousDownloadAccept(
DownloadDangerType danger_type,
const base::FilePath& file_path);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadRetry(
DownloadInterruptReason reason);
COMPONENTS_DOWNLOAD_EXPORT DownloadContent
DownloadContentFromMimeType(const std::string& mime_type_string,
bool record_content_subcategory);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadMimeType(
const std::string& mime_type,
bool is_transient);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadMimeTypeForNormalProfile(
const std::string& mime_type,
bool is_transient);
COMPONENTS_DOWNLOAD_EXPORT void RecordFileBandwidth(
size_t length,
base::TimeDelta elapsed_time);
COMPONENTS_DOWNLOAD_EXPORT void RecordParallelizableDownloadCount(
DownloadCountTypes type,
bool is_parallel_download_enabled);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadFileRenameResultAfterRetry(
base::TimeDelta time_since_first_failure,
DownloadInterruptReason interrupt_reason);
enum DownloadConnectionSecurity { … };
enum class DownloadMetricsCallsite { … };
enum class InputStreamReadError { … };
COMPONENTS_DOWNLOAD_EXPORT DownloadConnectionSecurity
CheckDownloadConnectionSecurity(const GURL& download_url,
const std::vector<GURL>& url_chain);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadValidationMetrics(
DownloadMetricsCallsite callsite,
DownloadConnectionSecurity state,
DownloadContent file_type);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadConnectionSecurity(
const GURL& download_url,
const std::vector<GURL>& url_chain);
COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadHttpResponseCode(
int response_code,
bool is_background_mode);
COMPONENTS_DOWNLOAD_EXPORT void RecordResumptionStrongValidators(
DownloadInterruptReason reason);
COMPONENTS_DOWNLOAD_EXPORT void RecordParallelRequestCreationFailure(
DownloadInterruptReason reason);
COMPONENTS_DOWNLOAD_EXPORT int
GetParallelRequestCreationFailureCountForTesting();
COMPONENTS_DOWNLOAD_EXPORT void RecordInputStreamReadError(
MojoResult mojo_result);
#if BUILDFLAG(IS_ANDROID)
enum class BackgroudTargetDeterminationResultTypes {
kSuccess = 0,
kTargetPathMissing = 1,
kPathReservationFailed = 2,
kMaxValue = kPathReservationFailed
};
COMPONENTS_DOWNLOAD_EXPORT void RecordDuplicatePdfDownloadTriggered(
bool open_inline);
#endif
}
#endif