chromium/components/payments/content/payment_request.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/payments/content/payment_request.h"

#include <string>
#include <utility>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "components/payments/content/content_payment_request_delegate.h"
#include "components/payments/content/has_enrolled_instrument_query_factory.h"
#include "components/payments/content/payment_app.h"
#include "components/payments/content/payment_details_converter.h"
#include "components/payments/content/payment_request_converter.h"
#include "components/payments/content/payment_request_web_contents_manager.h"
#include "components/payments/content/secure_payment_confirmation_no_creds.h"
#include "components/payments/core/error_message_util.h"
#include "components/payments/core/error_strings.h"
#include "components/payments/core/features.h"
#include "components/payments/core/has_enrolled_instrument_query.h"
#include "components/payments/core/method_strings.h"
#include "components/payments/core/native_error_strings.h"
#include "components/payments/core/payment_details.h"
#include "components/payments/core/payment_details_validation.h"
#include "components/payments/core/payment_prefs.h"
#include "components/payments/core/payment_request_delegate.h"
#include "components/payments/core/payments_validators.h"
#include "components/payments/core/url_util.h"
#include "components/prefs/pref_service.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"

namespace payments {
namespace {

CanMakePaymentQueryResult;
HasEnrolledInstrumentQueryResult;

// Redact shipping address before exposing it in ShippingAddressChangeEvent.
// https://w3c.github.io/payment-request/#shipping-address-changed-algorithm
mojom::PaymentAddressPtr RedactShippingAddress(
    mojom::PaymentAddressPtr address) {}
}  // namespace

PaymentRequest::PaymentRequest(
    std::unique_ptr<ContentPaymentRequestDelegate> delegate,
    mojo::PendingReceiver<mojom::PaymentRequest> receiver)
    :{}

PaymentRequest::~PaymentRequest() {}

void PaymentRequest::Init(
    mojo::PendingRemote<mojom::PaymentRequestClient> client,
    std::vector<mojom::PaymentMethodDataPtr> method_data,
    mojom::PaymentDetailsPtr details,
    mojom::PaymentOptionsPtr options) {}

void PaymentRequest::Show(bool wait_for_updated_details,
                          bool had_user_activation) {}

void PaymentRequest::Retry(mojom::PaymentValidationErrorsPtr errors) {}

void PaymentRequest::UpdateWith(mojom::PaymentDetailsPtr details) {}

void PaymentRequest::OnPaymentDetailsNotUpdated() {}

void PaymentRequest::Abort() {}

void PaymentRequest::Complete(mojom::PaymentComplete result) {}

void PaymentRequest::CanMakePayment() {}

void PaymentRequest::HasEnrolledInstrument() {}

bool PaymentRequest::ChangePaymentMethod(const std::string& method_name,
                                         const std::string& stringified_data) {}

bool PaymentRequest::ChangeShippingOption(
    const std::string& shipping_option_id) {}

bool PaymentRequest::ChangeShippingAddress(
    mojom::PaymentAddressPtr shipping_address) {}

void PaymentRequest::AreRequestedMethodsSupportedCallback(
    bool methods_supported,
    const std::string& error_message,
    AppCreationFailureReason error_reason) {}

base::WeakPtr<PaymentRequest> PaymentRequest::GetWeakPtr() {}

void PaymentRequest::AllowConnectToSource(
    const GURL& url,
    const GURL& url_before_redirects,
    bool did_follow_redirect,
    base::OnceCallback<void(bool)> result_callback) {}

void PaymentRequest::OnInitialized(InitializationTask* initialization_task) {}

bool PaymentRequest::IsInitialized() const {}

bool PaymentRequest::IsThisPaymentRequestShowing() const {}

bool PaymentRequest::OnlySingleAppCanProvideAllRequiredInformation() const {}

bool PaymentRequest::CheckSatisfiesSkipUIConstraintsAndRecordShownState() {}

void PaymentRequest::OnPaymentResponseAvailable(
    mojom::PaymentResponsePtr response) {}

void PaymentRequest::OnPaymentResponseError(const std::string& error_message) {}

void PaymentRequest::OnShippingOptionIdSelected(
    std::string shipping_option_id) {}

void PaymentRequest::OnShippingAddressSelected(
    mojom::PaymentAddressPtr address) {}

void PaymentRequest::OnPayerInfoSelected(mojom::PayerDetailPtr payer_info) {}

void PaymentRequest::OnUserCancelled() {}

void PaymentRequest::OnUserOptedOut() {}

void PaymentRequest::ReadyToCommitNavigation(
    content::NavigationHandle* navigation_handle) {}

void PaymentRequest::WillBeDestroyed(
    content::DocumentServiceDestructionReason reason) {}

void PaymentRequest::Pay() {}

JourneyLogger::PaymentMethodCategory PaymentRequest::GetSelectedMethodCategory()
    const {}

bool PaymentRequest::IsOffTheRecord() const {}

void PaymentRequest::OnPaymentHandlerOpenWindowCalled() {}

void PaymentRequest::RecordFirstAbortReason(
    JourneyLogger::AbortReason abort_reason) {}

void PaymentRequest::CanMakePaymentCallback(bool can_make_payment) {}

void PaymentRequest::HasEnrolledInstrumentCallback(
    bool has_enrolled_instrument) {}

void PaymentRequest::RespondToHasEnrolledInstrumentQuery(
    bool has_enrolled_instrument,
    bool warn_local_development) {}

void PaymentRequest::OnAbortResult(bool aborted) {}

void PaymentRequest::ShowErrorMessageAndAbortPayment() {}

}  // namespace payments