chromium/components/feedback/feedback_common.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// The below thresholds were chosen arbitrarily to conveniently show small data
// as part of the report itself without having to look into the system_logs.zip
// file.
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)
// Keep in sync with
// google3/java/com/google/wireless/android/tools/betterbug/protos/uploadfeedbackreport.proto.
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";
// Enum value for MAC_ADDRESS type.
constexpr char kTargetDeviceIdTypeMacAddressValue[] = "1";
constexpr char kInitiatingDeviceNameValue[] = "Chromebook";
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

constexpr char kIsOffensiveOrUnsafeKey[] =;

// Determine if the given feedback value is small enough to not need to
// be compressed.
bool BelowCompressionThreshold(const std::string& content) {}

void AddFeedbackData(userfeedback::ExtensionSubmit* feedback_data,
                     const std::string& key,
                     const std::string& value) {}

// Adds data as an attachment to feedback_data if the data is non-empty.
void AddAttachment(userfeedback::ExtensionSubmit* feedback_data,
                   const char* name,
                   const std::string& data) {}

}  // namespace

////////////////////////////////////////////////////////////////////////////////
// FeedbackCommon::AttachedFile::
////////////////////////////////////////////////////////////////////////////////

FeedbackCommon::AttachedFile::AttachedFile(const std::string& filename,
                                           std::string data)
    :{}

FeedbackCommon::AttachedFile::~AttachedFile() {}

////////////////////////////////////////////////////////////////////////////////
// FeedbackCommon::
////////////////////////////////////////////////////////////////////////////////

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) {}

// static
bool FeedbackCommon::IncludeInSystemLogs(const std::string& key,
                                         bool is_google_email) {}

// static
int FeedbackCommon::GetChromeBrowserProductId() {}

// static
int FeedbackCommon::GetMahiProductId() {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
// static
int FeedbackCommon::GetChromeOSProductId() {
  return feedback::kChromeOSProductId;
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

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 {}