#include "components/autofill/core/browser/payments/payments_network_interface_base.h"
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "components/autofill/core/browser/payments/account_info_getter.h"
#include "components/autofill/core/browser/payments/payments_autofill_client.h"
#include "components/autofill/core/browser/payments/payments_requests/payments_request.h"
#include "components/autofill/core/browser/payments/payments_service_url.h"
#include "components/signin/public/identity_manager/access_token_fetcher.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/variations/net/variations_http_headers.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/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
namespace autofill::payments {
namespace {
PaymentsRpcResult;
const char kTokenFetchId[] = …;
const char kPaymentsOAuth2Scope[] = …;
GURL GetRequestUrl(const std::string& path) { … }
}
PaymentsNetworkInterfaceBase::PaymentsNetworkInterfaceBase(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
signin::IdentityManager* identity_manager,
AccountInfoGetter* account_info_getter,
bool is_off_the_record)
: … { … }
PaymentsNetworkInterfaceBase::~PaymentsNetworkInterfaceBase() = default;
void PaymentsNetworkInterfaceBase::CancelRequest() { … }
void PaymentsNetworkInterfaceBase::set_url_loader_factory_for_testing(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { … }
void PaymentsNetworkInterfaceBase::set_access_token_for_testing(
std::string access_token) { … }
void PaymentsNetworkInterfaceBase::IssueRequest(
std::unique_ptr<PaymentsRequest> request) { … }
void PaymentsNetworkInterfaceBase::InitializeResourceRequest() { … }
void PaymentsNetworkInterfaceBase::OnSimpleLoaderComplete(
std::unique_ptr<std::string> response_body) { … }
void PaymentsNetworkInterfaceBase::OnSimpleLoaderCompleteInternal(
int response_code,
const std::string& data) { … }
void PaymentsNetworkInterfaceBase::AccessTokenFetchFinished(
GoogleServiceAuthError error,
signin::AccessTokenInfo access_token_info) { … }
void PaymentsNetworkInterfaceBase::AccessTokenError(
const GoogleServiceAuthError& error) { … }
void PaymentsNetworkInterfaceBase::StartTokenFetch(bool invalidate_old) { … }
void PaymentsNetworkInterfaceBase::SetOAuth2TokenAndStartRequest() { … }
}