#include "chrome/browser/ui/views/autofill/payments/local_card_migration_dialog_view.h"
#include <memory>
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/i18n/message_formatter.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/autofill/payments/local_card_migration_dialog_factory.h"
#include "chrome/browser/ui/autofill/payments/local_card_migration_dialog_state.h"
#include "chrome/browser/ui/autofill/payments/payments_ui_constants.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/autofill/payments/migratable_card_view.h"
#include "chrome/browser/ui/views/autofill/payments/payments_view_util.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "components/autofill/core/browser/payments/local_card_migration_manager.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/grit/components_scaled_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.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/mojom/dialog_button.mojom.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/separator.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/style/typography.h"
#include "ui/views/view_utils.h"
#include "ui/views/widget/widget.h"
namespace autofill {
namespace {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
class AutofillMigrationHeaderView : public views::ImageView {
METADATA_HEADER(AutofillMigrationHeaderView, views::ImageView)
public:
AutofillMigrationHeaderView() {
constexpr int kImageBorderBottom = 8;
SetBorder(views::CreateEmptyBorder(
gfx::Insets::TLBR(0, 0, kImageBorderBottom, 0)));
SetAccessibleName(l10n_util::GetStringUTF16(
IDS_AUTOFILL_GOOGLE_PAY_LOGO_ACCESSIBLE_NAME));
}
void OnThemeChanged() override {
ImageView::OnThemeChanged();
SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
GetNativeTheme()->ShouldUseDarkColors()
? IDR_AUTOFILL_MIGRATION_DIALOG_HEADER_DARK
: IDR_AUTOFILL_MIGRATION_DIALOG_HEADER));
}
};
BEGIN_METADATA(AutofillMigrationHeaderView)
END_METADATA
#endif
std::unique_ptr<views::BoxLayoutView> CreateTipTextContainer(
const std::u16string& tip_message) { … }
std::unique_ptr<views::Label> CreateTitle(
LocalCardMigrationDialogState view_state,
int card_list_size) { … }
std::unique_ptr<views::Label> CreateExplanationText(
LocalCardMigrationDialogState view_state,
int card_list_size,
const std::u16string& user_email) { … }
std::unique_ptr<views::ScrollView> CreateCardList(
const std::vector<MigratableCreditCard>& migratable_credit_cards,
LocalCardMigrationDialogView* dialog_view,
bool should_show_checkbox) { … }
std::unique_ptr<views::View> CreateFeedbackContentView(
LocalCardMigrationDialogController* controller,
LocalCardMigrationDialogView* dialog_view) { … }
constexpr int kLegalMessageScrollViewHeight = …;
}
class LocalCardMigrationOfferView : public views::View { … };
BEGIN_METADATA(…)
LocalCardMigrationDialogView::LocalCardMigrationDialogView(
LocalCardMigrationDialogController* controller)
: … { … }
LocalCardMigrationDialogView::~LocalCardMigrationDialogView() { … }
void LocalCardMigrationDialogView::ShowDialog(
content::WebContents& web_contents) { … }
void LocalCardMigrationDialogView::CloseDialog() { … }
void LocalCardMigrationDialogView::OnDialogAccepted() { … }
void LocalCardMigrationDialogView::OnDialogCancelled() { … }
bool LocalCardMigrationDialogView::GetEnableOkButton() const { … }
void LocalCardMigrationDialogView::DeleteCard(const std::string& guid) { … }
void LocalCardMigrationDialogView::OnCardCheckboxToggled() { … }
void LocalCardMigrationDialogView::UpdateLayout() { … }
void LocalCardMigrationDialogView::ConstructView() { … }
std::u16string LocalCardMigrationDialogView::GetOkButtonLabel() const { … }
std::u16string LocalCardMigrationDialogView::GetCancelButtonLabel() const { … }
LocalCardMigrationDialog* CreateLocalCardMigrationDialogView(
LocalCardMigrationDialogController* controller) { … }
BEGIN_METADATA(…)
}