#include "components/payments/content/secure_payment_confirmation_app.h"
#include <utility>
#include "base/base64.h"
#include "base/base64url.h"
#include "base/check.h"
#include "base/containers/flat_tree.h"
#include "base/feature_list.h"
#include "base/json/json_writer.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/payments/content/payment_request_spec.h"
#include "components/payments/core/error_strings.h"
#include "components/payments/core/method_strings.h"
#include "components/payments/core/payer_data.h"
#include "components/webauthn/core/browser/internal_authenticator.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "crypto/sha2.h"
#include "device/fido/fido_transport_protocol.h"
#include "device/fido/fido_types.h"
#include "device/fido/public_key_credential_descriptor.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "url/url_constants.h"
namespace payments {
namespace {
static constexpr int kDefaultTimeoutMinutes = …;
void RecordSystemPromptResult(
const SecurePaymentConfirmationSystemPromptResult result) { … }
}
SecurePaymentConfirmationApp::SecurePaymentConfirmationApp(
content::WebContents* web_contents_to_observe,
const std::string& effective_relying_party_identity,
const std::u16string& payment_instrument_label,
std::unique_ptr<SkBitmap> payment_instrument_icon,
std::vector<uint8_t> credential_id,
const url::Origin& merchant_origin,
base::WeakPtr<PaymentRequestSpec> spec,
mojom::SecurePaymentConfirmationRequestPtr request,
std::unique_ptr<webauthn::InternalAuthenticator> authenticator,
const std::u16string& network_label,
const SkBitmap& network_icon,
const std::u16string& issuer_label,
const SkBitmap& issuer_icon)
: … { … }
SecurePaymentConfirmationApp::~SecurePaymentConfirmationApp() = default;
void SecurePaymentConfirmationApp::InvokePaymentApp(
base::WeakPtr<Delegate> delegate) { … }
bool SecurePaymentConfirmationApp::IsCompleteForPayment() const { … }
bool SecurePaymentConfirmationApp::CanPreselect() const { … }
std::u16string SecurePaymentConfirmationApp::GetMissingInfoLabel() const { … }
bool SecurePaymentConfirmationApp::HasEnrolledInstrument() const { … }
void SecurePaymentConfirmationApp::RecordUse() { … }
bool SecurePaymentConfirmationApp::NeedsInstallation() const { … }
std::string SecurePaymentConfirmationApp::GetId() const { … }
std::u16string SecurePaymentConfirmationApp::GetLabel() const { … }
std::u16string SecurePaymentConfirmationApp::GetSublabel() const { … }
const SkBitmap* SecurePaymentConfirmationApp::icon_bitmap() const { … }
bool SecurePaymentConfirmationApp::IsValidForModifier(
const std::string& method) const { … }
base::WeakPtr<PaymentApp> SecurePaymentConfirmationApp::AsWeakPtr() { … }
bool SecurePaymentConfirmationApp::HandlesShippingAddress() const { … }
bool SecurePaymentConfirmationApp::HandlesPayerName() const { … }
bool SecurePaymentConfirmationApp::HandlesPayerEmail() const { … }
bool SecurePaymentConfirmationApp::HandlesPayerPhone() const { … }
bool SecurePaymentConfirmationApp::IsWaitingForPaymentDetailsUpdate() const { … }
void SecurePaymentConfirmationApp::UpdateWith(
mojom::PaymentRequestDetailsUpdatePtr details_update) { … }
void SecurePaymentConfirmationApp::OnPaymentDetailsNotUpdated() { … }
void SecurePaymentConfirmationApp::AbortPaymentApp(
base::OnceCallback<void(bool)> abort_callback) { … }
mojom::PaymentResponsePtr
SecurePaymentConfirmationApp::SetAppSpecificResponseFields(
mojom::PaymentResponsePtr response) const { … }
void SecurePaymentConfirmationApp::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) { … }
void SecurePaymentConfirmationApp::OnGetAssertion(
base::WeakPtr<Delegate> delegate,
blink::mojom::AuthenticatorStatus status,
blink::mojom::GetAssertionAuthenticatorResponsePtr response,
blink::mojom::WebAuthnDOMExceptionDetailsPtr dom_exception_details) { … }
}