#include "components/feedback/feedback_common.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/json/json_reader.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "components/feedback/feedback_constants.h"
#include "components/feedback/feedback_report.h"
#include "components/feedback/feedback_util.h"
#include "components/feedback/proto/common.pb.h"
#include "components/feedback/proto/dom.pb.h"
#include "components/feedback/proto/extension.pb.h"
#include "components/feedback/proto/math.pb.h"
#include "google_apis/gaia/gaia_auth_util.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#endif
namespace {
constexpr size_t kFeedbackMaxLength = …;
constexpr size_t kFeedbackMaxLineCount = …;
constexpr base::FilePath::CharType kLogsFilename[] = …);
constexpr char kLogsAttachmentName[] = …;
constexpr char kZipExt[] = …;
constexpr char kPngMimeType[] = …;
constexpr char kArbitraryMimeType[] = …;
#if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char kIsCrossDeviceIssueKey[] = "is_cross_device_issue";
constexpr char kIsCrossDeviceIssueTrueValue[] = "true";
constexpr char kTargetDeviceIdKey[] = "target_device_id";
constexpr char kTargetDeviceIdTypeKey[] = "target_device_id_type";
constexpr char kInitiatingDeviceName[] = "initiating_device_name";
constexpr char kTargetDeviceIdTypeMacAddressValue[] = "1";
constexpr char kInitiatingDeviceNameValue[] = "Chromebook";
#endif
constexpr char kIsOffensiveOrUnsafeKey[] = …;
bool BelowCompressionThreshold(const std::string& content) { … }
void AddFeedbackData(userfeedback::ExtensionSubmit* feedback_data,
const std::string& key,
const std::string& value) { … }
void AddAttachment(userfeedback::ExtensionSubmit* feedback_data,
const char* name,
const std::string& data) { … }
}
FeedbackCommon::AttachedFile::AttachedFile(const std::string& filename,
std::string data)
: … { … }
FeedbackCommon::AttachedFile::~AttachedFile() { … }
FeedbackCommon::FeedbackCommon() : … { … }
void FeedbackCommon::AddFile(const std::string& filename, std::string data) { … }
void FeedbackCommon::AddLog(std::string name, std::string value) { … }
void FeedbackCommon::AddLogs(SystemLogsMap logs) { … }
bool FeedbackCommon::RemoveLog(std::string name) { … }
void FeedbackCommon::PrepareReport(
userfeedback::ExtensionSubmit* feedback_data) const { … }
void FeedbackCommon::RedactDescription(redaction::RedactionTool& redactor) { … }
bool FeedbackCommon::IncludeInSystemLogs(const std::string& key,
bool is_google_email) { … }
int FeedbackCommon::GetChromeBrowserProductId() { … }
int FeedbackCommon::GetMahiProductId() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
int FeedbackCommon::GetChromeOSProductId() {
return feedback::kChromeOSProductId;
}
#endif
FeedbackCommon::~FeedbackCommon() = default;
void FeedbackCommon::CompressFile(const base::FilePath& filename,
const std::string& zipname,
std::string data_to_be_compressed) { … }
void FeedbackCommon::CompressLogs() { … }
void FeedbackCommon::AddFilesAndLogsToReport(
userfeedback::ExtensionSubmit* feedback_data) const { … }