#include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_file_processor.h"
#include "base/check.h"
#include "base/containers/fixed_flat_map.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "components/safe_browsing/core/common/features.h"
#include "crypto/sha2.h"
namespace safe_browsing {
namespace {
constexpr int64_t kMaxFilesToProcess = …;
constexpr int64_t kMaxFileSizeBytes = …;
constexpr int64_t kMaxFilesToRead = …;
constexpr base::FilePath::CharType kManifestFilePath[] = …);
constexpr base::FilePath::CharType kJSFileSuffix[] = …);
constexpr base::FilePath::CharType kHTMLFileSuffix[] = …);
constexpr base::FilePath::CharType kCSSFileSuffix[] = …);
constexpr auto kFileTypePriorityMap = …;
void RecordLargestFileSizeObserved(size_t size) { … }
void RecordNumFilesFound(int count) { … }
void RecordNumFilesOverProcessingLimit(int count) { … }
void RecordNumFilesOverSizeLimit(int count) { … }
void RecordNumFilesProcessed(int count) { … }
void RecordProcessedFileSize(size_t size) { … }
void RecordValidExtension(bool valid) { … }
}
struct ExtensionTelemetryFileProcessor::FileExtensionsComparator { … };
ExtensionTelemetryFileProcessor::~ExtensionTelemetryFileProcessor() = default;
ExtensionTelemetryFileProcessor::ExtensionTelemetryFileProcessor()
: … { … }
base::Value::Dict ExtensionTelemetryFileProcessor::ProcessExtension(
const base::FilePath& root_dir) { … }
ExtensionTelemetryFileProcessor::SortedFilePaths
ExtensionTelemetryFileProcessor::RetrieveFilePaths(
const base::FilePath& root_dir) { … }
base::Value::Dict ExtensionTelemetryFileProcessor::ComputeHashes(
const base::FilePath& root_dir,
const SortedFilePaths& file_paths) { … }
bool ExtensionTelemetryFileProcessor::IsApplicableType(
const base::FilePath& file_path) { … }
void ExtensionTelemetryFileProcessor::SetMaxFilesToProcessForTest(
int64_t max_files_to_process) { … }
void ExtensionTelemetryFileProcessor::SetMaxFileSizeBytesForTest(
int64_t max_file_size) { … }
void ExtensionTelemetryFileProcessor::SetMaxFilesToReadForTest(
int64_t max_files_to_read) { … }
}