#include "google_apis/gcm/engine/unregistration_request.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/values.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gcm/base/gcm_util.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.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 gcm {
namespace {
const char kRequestContentType[] = …;
const char kCategoryKey[] = …;
const char kSubtypeKey[] = …;
const char kDeleteKey[] = …;
const char kDeleteValue[] = …;
const char kDeviceIdKey[] = …;
const char kLoginHeader[] = …;
const char kErrorPrefix[] = …;
const char kInvalidParameters[] = …;
const char kInternalServerError[] = …;
const char kDeviceRegistrationError[] = …;
UnregistrationRequest::Status GetStatusFromError(const std::string& error) { … }
bool ShouldRetryWithStatus(UnregistrationRequest::Status status) { … }
}
UnregistrationRequest::RequestInfo::RequestInfo(uint64_t android_id,
uint64_t security_token,
const std::string& category,
const std::string& subtype)
: … { … }
UnregistrationRequest::RequestInfo::~RequestInfo() { … }
UnregistrationRequest::CustomRequestHandler::CustomRequestHandler() { … }
UnregistrationRequest::CustomRequestHandler::~CustomRequestHandler() { … }
UnregistrationRequest::UnregistrationRequest(
const GURL& registration_url,
const RequestInfo& request_info,
std::unique_ptr<CustomRequestHandler> custom_request_handler,
const net::BackoffEntry::Policy& backoff_policy,
UnregistrationCallback callback,
int max_retry_count,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
GCMStatsRecorder* recorder,
const std::string& source_to_record)
: … { … }
UnregistrationRequest::~UnregistrationRequest() { … }
void UnregistrationRequest::Start() { … }
void UnregistrationRequest::BuildRequestHeaders(
net::HttpRequestHeaders* headers) { … }
void UnregistrationRequest::BuildRequestBody(std::string* body) { … }
UnregistrationRequest::Status UnregistrationRequest::ParseResponse(
const network::SimpleURLLoader* source,
std::unique_ptr<std::string> body) { … }
void UnregistrationRequest::RetryWithBackoff() { … }
void UnregistrationRequest::OnURLLoadComplete(
const network::SimpleURLLoader* source,
std::unique_ptr<std::string> body) { … }
}