#include "components/sync/service/sync_stopped_reporter.h"
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/stringprintf.h"
#include "components/sync/protocol/sync.pb.h"
#include "google_apis/credentials_mode.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
namespace syncer {
namespace {
const char kEventEndpoint[] = …;
constexpr base::TimeDelta kRequestTimeout = …;
void LogSyncStoppedRequestTimeout(bool timed_out) { … }
void LogSyncStoppedRequestResult(const network::SimpleURLLoader& url_loader) { … }
}
SyncStoppedReporter::SyncStoppedReporter(
const GURL& sync_service_url,
const std::string& user_agent,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
SyncStoppedReporter::~SyncStoppedReporter() = default;
void SyncStoppedReporter::ReportSyncStopped(const std::string& access_token,
const std::string& cache_guid,
const std::string& birthday) { … }
void SyncStoppedReporter::OnSimpleLoaderComplete(
std::unique_ptr<std::string> response_body) { … }
void SyncStoppedReporter::OnTimeout() { … }
GURL SyncStoppedReporter::GetSyncEventURL(const GURL& sync_service_url) { … }
}