| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 class PaymentRequest; | 26 class PaymentRequest; |
| 27 class PaymentRequestSheetController; | 27 class PaymentRequestSheetController; |
| 28 | 28 |
| 29 // Maps views owned by PaymentRequestDialogView::view_stack_ to their | 29 // Maps views owned by PaymentRequestDialogView::view_stack_ to their |
| 30 // controller. PaymentRequestDialogView is responsible for listening for those | 30 // controller. PaymentRequestDialogView is responsible for listening for those |
| 31 // views being removed from the hierarchy and delete the associated controllers. | 31 // views being removed from the hierarchy and delete the associated controllers. |
| 32 using ControllerMap = | 32 using ControllerMap = |
| 33 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; | 33 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; |
| 34 | 34 |
| 35 enum class BackNavigationType { |
| 36 kOneStep = 0, |
| 37 kPaymentSheet, |
| 38 }; |
| 39 |
| 35 // The dialog delegate that represents a desktop WebPayments dialog. This class | 40 // The dialog delegate that represents a desktop WebPayments dialog. This class |
| 36 // is responsible for displaying the view associated with the current state of | 41 // is responsible for displaying the view associated with the current state of |
| 37 // the WebPayments flow and managing the transition between those states. | 42 // the WebPayments flow and managing the transition between those states. |
| 38 class PaymentRequestDialogView : public views::DialogDelegateView, | 43 class PaymentRequestDialogView : public views::DialogDelegateView, |
| 39 public PaymentRequestDialog, | 44 public PaymentRequestDialog, |
| 40 public PaymentRequestSpec::Observer { | 45 public PaymentRequestSpec::Observer { |
| 41 public: | 46 public: |
| 42 class ObserverForTest { | 47 class ObserverForTest { |
| 43 public: | 48 public: |
| 44 virtual void OnDialogOpened() = 0; | 49 virtual void OnDialogOpened() = 0; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void GoBackToPaymentSheet(); | 106 void GoBackToPaymentSheet(); |
| 102 void ShowContactProfileSheet(); | 107 void ShowContactProfileSheet(); |
| 103 void ShowOrderSummary(); | 108 void ShowOrderSummary(); |
| 104 void ShowShippingProfileSheet(); | 109 void ShowShippingProfileSheet(); |
| 105 void ShowPaymentMethodSheet(); | 110 void ShowPaymentMethodSheet(); |
| 106 void ShowShippingOptionSheet(); | 111 void ShowShippingOptionSheet(); |
| 107 // |credit_card| is the card to be edited, or nullptr for adding a card. | 112 // |credit_card| is the card to be edited, or nullptr for adding a card. |
| 108 // |on_edited| is called when |credit_card| was successfully edited, and | 113 // |on_edited| is called when |credit_card| was successfully edited, and |
| 109 // |on_added| is called when a new credit card was added (the reference is | 114 // |on_added| is called when a new credit card was added (the reference is |
| 110 // short-lived; callee should make a copy of the CreditCard object). | 115 // short-lived; callee should make a copy of the CreditCard object). |
| 116 // |back_navigation_type| identifies the type of navigation to execute once |
| 117 // the editor has completed successfully. |next_ui_tag| is the lowest value |
| 118 // that the credit card editor can use to assign to custom controls. |
| 111 void ShowCreditCardEditor( | 119 void ShowCreditCardEditor( |
| 120 BackNavigationType back_navigation_type, |
| 121 int next_ui_tag, |
| 112 base::OnceClosure on_edited, | 122 base::OnceClosure on_edited, |
| 113 base::OnceCallback<void(const autofill::CreditCard&)> on_added, | 123 base::OnceCallback<void(const autofill::CreditCard&)> on_added, |
| 114 autofill::CreditCard* credit_card = nullptr); | 124 autofill::CreditCard* credit_card = nullptr); |
| 115 // |profile| is the address to be edited, or nullptr for adding an address. | 125 // |profile| is the address to be edited, or nullptr for adding an address. |
| 116 // |on_edited| is called when |profile| was successfully edited, and | 126 // |on_edited| is called when |profile| was successfully edited, and |
| 117 // |on_added| is called when a new profile was added (the reference is | 127 // |on_added| is called when a new profile was added (the reference is |
| 118 // short-lived; callee should make a copy of the profile object). | 128 // short-lived; callee should make a copy of the profile object). |
| 129 // |back_navigation_type| identifies the type of navigation to execute once |
| 130 // the editor has completed successfully. |
| 119 void ShowShippingAddressEditor( | 131 void ShowShippingAddressEditor( |
| 132 BackNavigationType back_navigation_type, |
| 120 base::OnceClosure on_edited, | 133 base::OnceClosure on_edited, |
| 121 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, | 134 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, |
| 122 autofill::AutofillProfile* profile); | 135 autofill::AutofillProfile* profile); |
| 123 // |profile| is the profile to be edited, or nullptr for adding a profile. | 136 // |profile| is the profile to be edited, or nullptr for adding a profile. |
| 124 void ShowContactInfoEditor(autofill::AutofillProfile* profile = nullptr); | 137 // |back_navigation_type| identifies the type of navigation to execute once |
| 138 // the editor has completed successfully. |
| 139 void ShowContactInfoEditor(BackNavigationType back_navigation_type, |
| 140 autofill::AutofillProfile* profile = nullptr); |
| 125 void EditorViewUpdated(); | 141 void EditorViewUpdated(); |
| 126 | 142 |
| 127 void ShowCvcUnmaskPrompt( | 143 void ShowCvcUnmaskPrompt( |
| 128 const autofill::CreditCard& credit_card, | 144 const autofill::CreditCard& credit_card, |
| 129 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 145 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
| 130 result_delegate, | 146 result_delegate, |
| 131 content::WebContents* web_contents) override; | 147 content::WebContents* web_contents) override; |
| 132 | 148 |
| 133 // Shows a full dialog spinner with the "processing" label that doesn't offer | 149 // Shows a full dialog spinner with the "processing" label that doesn't offer |
| 134 // a way of closing the dialog. | 150 // a way of closing the dialog. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 164 // Used when the dialog is being closed to avoid re-entrancy into the | 180 // Used when the dialog is being closed to avoid re-entrancy into the |
| 165 // controller_map_. | 181 // controller_map_. |
| 166 bool being_closed_; | 182 bool being_closed_; |
| 167 | 183 |
| 168 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); | 184 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); |
| 169 }; | 185 }; |
| 170 | 186 |
| 171 } // namespace payments | 187 } // namespace payments |
| 172 | 188 |
| 173 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 189 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
| OLD | NEW |