#include "components/feedback/feedback_uploader.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/feedback/features.h"
#include "components/feedback/feedback_report.h"
#include "components/feedback/feedback_switches.h"
#include "components/variations/net/variations_http_headers.h"
#include "net/base/load_flags.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
namespace feedback {
namespace {
constexpr char kReportSendingResultHistogramName[] = …;
enum class FeedbackReportSendingResult { … };
constexpr base::FilePath::CharType kFeedbackReportPath[] = …);
constexpr char kFeedbackPostUrl[] = …;
constexpr char kProtoBufMimeType[] = …;
constexpr int kHttpPostSuccessNoContent = …;
constexpr int kHttpPostFailNoConnection = …;
constexpr int kHttpPostFailClientError = …;
constexpr int kHttpPostFailServerError = …;
base::TimeDelta g_minimum_retry_delay = …;
base::TimeDelta g_dispatching_wait_delay = …;
GURL GetFeedbackPostGURL() { … }
scoped_refptr<base::SingleThreadTaskRunner> CreateUploaderTaskRunner() { … }
}
FeedbackUploader::FeedbackUploader(
bool is_off_the_record,
const base::FilePath& state_path,
SharedURLLoaderFactoryGetter shared_url_loader_factory_getter)
: … { … }
FeedbackUploader::FeedbackUploader(
bool is_off_the_record,
const base::FilePath& state_path,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory)
: … { … }
FeedbackUploader::~FeedbackUploader() { … }
void FeedbackUploader::SetMinimumRetryDelayForTesting(base::TimeDelta delay) { … }
void FeedbackUploader::QueueReport(std::unique_ptr<std::string> data,
bool has_email,
int product_id) { … }
void FeedbackUploader::RequeueReport(scoped_refptr<FeedbackReport> report) { … }
void FeedbackUploader::StartDispatchingReport() { … }
void FeedbackUploader::OnReportUploadSuccess() { … }
void FeedbackUploader::OnReportUploadFailure(bool should_retry) { … }
bool FeedbackUploader::ReportsUploadTimeComparator::operator()(
const scoped_refptr<FeedbackReport>& a,
const scoped_refptr<FeedbackReport>& b) const { … }
FeedbackUploader::FeedbackUploader(
bool is_off_the_record,
const base::FilePath& state_path,
SharedURLLoaderFactoryGetter url_loader_factory_getter,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
void FeedbackUploader::AppendExtraHeadersToUploadRequest(
network::ResourceRequest* resource_request) { … }
void FeedbackUploader::DispatchReport() { … }
void FeedbackUploader::OnDispatchComplete(
UrlLoaderList::iterator it,
std::unique_ptr<std::string> response_body) { … }
void FeedbackUploader::UpdateUploadTimer() { … }
}