#include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
#include <algorithm>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/i18n/message_formatter.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/browser/ui/views/payments/payment_request_row_view.h"
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "chrome/common/url_constants.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/payments/content/payment_app.h"
#include "components/payments/content/payment_request_spec.h"
#include "components/payments/content/payment_request_state.h"
#include "components/payments/core/currency_formatter.h"
#include "components/payments/core/payment_prefs.h"
#include "components/payments/core/strings_util.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/font.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/range/range.h"
#include "ui/gfx/text_elider.h"
#include "ui/gfx/text_utils.h"
#include "ui/gfx/vector_icon_utils.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/layout/table_layout_view.h"
#include "ui/views/view.h"
namespace payments {
namespace {
class PreviewEliderLabel : public views::Label { … };
BEGIN_METADATA(…)
std::unique_ptr<PaymentRequestRowView> CreatePaymentSheetRow(
views::Button::PressedCallback callback,
const std::u16string& section_name,
const std::u16string& accessible_content,
std::unique_ptr<views::View> content_view,
std::unique_ptr<views::View> extra_content_view,
std::unique_ptr<views::View> trailing_button,
bool clickable,
bool extra_trailing_inset,
views::LayoutAlignment vertical_alignment =
views::LayoutAlignment::kStart) { … }
std::unique_ptr<views::View> CreateInlineCurrencyAmountItem(
const std::u16string& currency,
const std::u16string& amount,
bool hint_color,
bool bold) { … }
class PaymentSheetRowBuilder { … };
}
PaymentSheetViewController::PaymentSheetViewController(
base::WeakPtr<PaymentRequestSpec> spec,
base::WeakPtr<PaymentRequestState> state,
base::WeakPtr<PaymentRequestDialogView> dialog)
: … { … }
PaymentSheetViewController::~PaymentSheetViewController() { … }
void PaymentSheetViewController::OnSpecUpdated() { … }
void PaymentSheetViewController::OnSelectedInformationChanged() { … }
void PaymentSheetViewController::ButtonPressed(base::RepeatingClosure closure) { … }
PaymentRequestSheetController::ButtonCallback
PaymentSheetViewController::GetPrimaryButtonCallback() { … }
std::u16string PaymentSheetViewController::GetSecondaryButtonLabel() { … }
bool PaymentSheetViewController::ShouldShowHeaderBackArrow() { … }
std::u16string PaymentSheetViewController::GetSheetTitle() { … }
void PaymentSheetViewController::FillContentView(views::View* content_view) { … }
std::unique_ptr<views::View>
PaymentSheetViewController::CreateExtraFooterView() { … }
bool PaymentSheetViewController::GetSheetId(DialogViewID* sheet_id) { … }
base::WeakPtr<PaymentRequestSheetController>
PaymentSheetViewController::GetWeakPtr() { … }
std::unique_ptr<PaymentRequestRowView>
PaymentSheetViewController::CreatePaymentSheetSummaryRow() { … }
std::unique_ptr<views::View>
PaymentSheetViewController::CreateShippingSectionContent(
std::u16string* accessible_content) { … }
std::unique_ptr<PaymentRequestRowView>
PaymentSheetViewController::CreateShippingRow() { … }
std::unique_ptr<PaymentRequestRowView>
PaymentSheetViewController::CreatePaymentMethodRow() { … }
std::unique_ptr<views::View>
PaymentSheetViewController::CreateContactInfoSectionContent(
std::u16string* accessible_content) { … }
std::unique_ptr<PaymentRequestRowView>
PaymentSheetViewController::CreateContactInfoRow() { … }
std::unique_ptr<PaymentRequestRowView>
PaymentSheetViewController::CreateShippingOptionRow() { … }
std::unique_ptr<views::View> PaymentSheetViewController::CreateDataSourceRow() { … }
void PaymentSheetViewController::AddShippingButtonPressed() { … }
void PaymentSheetViewController::AddContactInfoButtonPressed() { … }
void PaymentSheetViewController::PossiblyIgnorePrimaryButtonPress(
PaymentRequestSheetController::ButtonCallback callback,
const ui::Event& event) { … }
}