#include "components/upload_list/text_log_upload_list.h"
#include <algorithm>
#include <optional>
#include <sstream>
#include <utility>
#include "base/containers/adapters.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
namespace {
constexpr size_t kUploadTimeIndex = …;
constexpr size_t kCaptureTimeIndex = …;
constexpr char kJsonLogKeyUploadId[] = …;
constexpr char kJsonLogKeyUploadTime[] = …;
constexpr char kJsonLogKeyLocalId[] = …;
constexpr char kJsonLogKeyCaptureTime[] = …;
constexpr char kJsonLogKeyState[] = …;
constexpr char kJsonLogKeySource[] = …;
constexpr char kJsonLogKeyPathHash[] = …;
std::vector<std::string> SplitIntoComponents(const std::string& line) { … }
bool CheckCsvUploadListOutOfRange(const std::string& line,
const base::Time& begin,
const base::Time& end) { … }
bool CheckFieldOutOfRange(const std::string* time_string,
const base::Time& begin,
const base::Time& end) { … }
bool CheckJsonUploadListOutOfRange(const base::Value::Dict& dict,
const base::Time& begin,
const base::Time& end) { … }
}
std::vector<std::string> TextLogUploadList::SplitIntoLines(
const std::string& file_contents) { … }
TextLogUploadList::TextLogUploadList(const base::FilePath& upload_log_path)
: … { … }
TextLogUploadList::~TextLogUploadList() = default;
std::vector<std::unique_ptr<UploadList::UploadInfo>>
TextLogUploadList::LoadUploadList() { … }
void TextLogUploadList::ClearUploadList(const base::Time& begin,
const base::Time& end) { … }
std::unique_ptr<UploadList::UploadInfo> TextLogUploadList::TryParseCsvLogEntry(
const std::string& log_line) { … }
std::unique_ptr<UploadList::UploadInfo> TextLogUploadList::TryParseJsonLogEntry(
const base::Value::Dict& dict) { … }
void TextLogUploadList::ParseLogEntries(
const std::vector<std::string>& log_entries,
std::vector<std::unique_ptr<UploadList::UploadInfo>>* uploads) { … }
void TextLogUploadList::RequestSingleUpload(const std::string& local_id) { … }