#include "components/payments/content/secure_payment_confirmation_app_factory.h"
#include <stdint.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/barrier_closure.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/payments/content/payment_manifest_web_data_service.h"
#include "components/payments/content/payment_request_spec.h"
#include "components/payments/content/secure_payment_confirmation_app.h"
#include "components/payments/core/features.h"
#include "components/payments/core/method_strings.h"
#include "components/payments/core/native_error_strings.h"
#include "components/payments/core/secure_payment_confirmation_credential.h"
#include "components/payments/core/sizes.h"
#include "components/webauthn/core/browser/internal_authenticator.h"
#include "components/webdata/common/web_data_results.h"
#include "components/webdata/common/web_data_service_base.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/webauthn_security_utils.h"
#include "content/public/common/content_features.h"
#include "services/data_decoder/public/cpp/decode_image.h"
#include "third_party/blink/public/mojom/payments/payment_request.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace payments {
namespace {
constexpr int64_t kMaxTimeoutInMilliseconds = …;
bool IsValidDomain(const std::string& rp_id) { … }
bool IsValid(const mojom::SecurePaymentConfirmationRequestPtr& request,
std::string* error_message) { … }
bool RequiresThirdPartyPaymentBit(const url::Origin& caller_origin,
const std::string& relying_party_id) { … }
enum class IconType { … };
struct IconInfo { … };
void DidDownloadIcon(IconInfo* icon_info,
base::OnceClosure done_closure,
int request_id,
int unused_http_status_code,
const GURL& unused_image_url,
const std::vector<SkBitmap>& bitmaps,
const std::vector<gfx::Size>& unused_sizes) { … }
}
struct SecurePaymentConfirmationAppFactory::Request
: public content::WebContentsObserver { … };
void SecurePaymentConfirmationAppFactory::
OnIsUserVerifyingPlatformAuthenticatorAvailable(
std::unique_ptr<Request> request,
bool is_available) { … }
SecurePaymentConfirmationAppFactory::SecurePaymentConfirmationAppFactory()
: … { … }
SecurePaymentConfirmationAppFactory::~SecurePaymentConfirmationAppFactory() { … }
void SecurePaymentConfirmationAppFactory::Create(
base::WeakPtr<Delegate> delegate) { … }
void SecurePaymentConfirmationAppFactory::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle handle,
std::unique_ptr<WDTypedResult> result) { … }
void SecurePaymentConfirmationAppFactory::OnGetMatchingCredentialIdsFromStore(
std::unique_ptr<Request> request,
std::string relying_party_id,
std::vector<std::vector<uint8_t>> matching_credentials) { … }
void SecurePaymentConfirmationAppFactory::OnRetrievedCredentials(
std::unique_ptr<Request> request,
std::vector<std::unique_ptr<SecurePaymentConfirmationCredential>>
credentials) { … }
void SecurePaymentConfirmationAppFactory::DidDownloadAllIcons(
std::unique_ptr<SecurePaymentConfirmationCredential> credential,
std::unique_ptr<Request> request) { … }
}