#include "google_apis/gcm/engine/checkin_request.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/sequenced_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
#include "google_apis/gcm/protocol/checkin.pb.h"
#include "net/base/load_flags.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 gcm {
namespace {
const char kRequestContentType[] = …;
const int kRequestVersionValue = …;
const int kDefaultUserSerialNumber = …;
enum class CheckinRequestStatus { … };
std::string GetCheckinRequestStatusString(CheckinRequestStatus status) { … }
void RecordCheckinStatusAndReportUMA(CheckinRequestStatus status,
GCMStatsRecorder* recorder,
bool will_retry) { … }
}
CheckinRequest::RequestInfo::RequestInfo(
uint64_t android_id,
uint64_t security_token,
const std::map<std::string, std::string>& account_tokens,
const std::string& settings_digest,
const checkin_proto::ChromeBuildProto& chrome_build_proto)
: … { … }
CheckinRequest::RequestInfo::RequestInfo(const RequestInfo& other) = default;
CheckinRequest::RequestInfo::~RequestInfo() = default;
CheckinRequest::CheckinRequest(
const GURL& checkin_url,
const RequestInfo& request_info,
const net::BackoffEntry::Policy& backoff_policy,
CheckinRequestCallback callback,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
GCMStatsRecorder* recorder)
: … { … }
CheckinRequest::~CheckinRequest() = default;
void CheckinRequest::Start() { … }
void CheckinRequest::RetryWithBackoff() { … }
void CheckinRequest::OnURLLoadComplete(const network::SimpleURLLoader* source,
std::unique_ptr<std::string> body) { … }
}