1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_PAYMENTS_VIEW_FACTORY_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_PAYMENTS_VIEW_FACTORY_H_
#include <memory>
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
namespace content {
class WebContents;
}
namespace autofill {
class AutofillErrorDialogController;
class AutofillErrorDialogView;
class AutofillProgressDialogController;
class AutofillProgressDialogView;
class BnplTosController;
class BnplTosView;
class CardUnmaskAuthenticationSelectionDialogController;
class CardUnmaskAuthenticationSelectionDialog;
class CardUnmaskOtpInputDialogController;
class CardUnmaskOtpInputDialogView;
class SaveAndFillDialogController;
class SaveAndFillDialogView;
namespace payments {
class PaymentsWindowUserConsentDialogController;
class PaymentsWindowUserConsentDialog;
class SelectBnplIssuerView;
class SelectBnplIssuerDialogController;
} // namespace payments
// Factory function for creating and showing the autofill progress dialog
// view.
// Note: On Desktop the view's ownership is transferred to the widget, which
// deletes it on dismissal, so no lifecycle management is needed. However, on
// Android this is not the case, the view's implementation must delete itself
// when dismissed.
std::unique_ptr<AutofillProgressDialogView> CreateAndShowProgressDialog(
base::WeakPtr<AutofillProgressDialogController> controller,
content::WebContents* web_contents);
// Factory function for creating and showing the view.
base::WeakPtr<AutofillErrorDialogView> CreateAndShowAutofillErrorDialog(
AutofillErrorDialogController* controller,
content::WebContents* web_contents);
// Factory function for the card unmask view creates and shows the dialog.
CardUnmaskAuthenticationSelectionDialog*
CreateAndShowCardUnmaskAuthenticationSelectionDialog(
content::WebContents* web_contents,
CardUnmaskAuthenticationSelectionDialogController* controller);
// Factory function for creating and showing the card unmask otp input dialog
// view. This dialog is shown when user needs to input the OTP text received
// to unmask the credit card.
base::WeakPtr<CardUnmaskOtpInputDialogView> CreateAndShowOtpInputDialog(
base::WeakPtr<CardUnmaskOtpInputDialogController> controller,
content::WebContents* web_contents);
// Factory function for creating the payments window user consent dialog. This
// dialog is triggered when a payments window flow is started and if there was
// no intentional user consent to open a pop-up and redirect to a payments
// window flow. Once the dialog is accepted, it is treated as receiving user
// consent and the payments window flow will start. If the dialog is cancelled,
// the flow will end.
base::WeakPtr<payments::PaymentsWindowUserConsentDialog>
CreateAndShowPaymentsWindowUserConsentDialog(
base::WeakPtr<payments::PaymentsWindowUserConsentDialogController>
controller,
content::WebContents* web_contents,
base::OnceClosure accept_callback,
base::OnceClosure cancel_callback);
// Factory function for creating and showing the BNPL Terms of Service.
std::unique_ptr<BnplTosView> CreateAndShowBnplTos(
base::WeakPtr<BnplTosController> controller,
content::WebContents* web_contents);
#if !BUILDFLAG(IS_ANDROID)
// Factory function for creating the "Save and Fill" dialog. This dialog
// is triggered when the user has no saved credit cards and clicks on the
// "Save and Fill" suggestion in the credit card dropdown menu. It presents
// a centered modal dialog where the user can conveniently save a new
// credit card and simultaneously fill it into the form with a single click.
std::unique_ptr<SaveAndFillDialogView> CreateAndShowSaveAndFillDialog(
base::WeakPtr<SaveAndFillDialogController> controller,
content::WebContents* web_contents);
#endif // !BUILDFLAG(IS_ANDROID)
// Factory function for creating and showing the BNPL issuer selection dialog.
// This dialog is triggered when the BNPL payment method has been selected and
// the user needs to select an issuer.
std::unique_ptr<payments::SelectBnplIssuerView>
CreateAndShowBnplIssuerSelectionDialog(
base::WeakPtr<payments::SelectBnplIssuerDialogController> controller,
content::WebContents* web_contents);
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_PAYMENTS_VIEW_FACTORY_H_
|