Chromium Code Reviews| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/views/payments/view_stack.h" | 12 #include "chrome/browser/ui/views/payments/view_stack.h" |
| 13 #include "components/autofill/core/browser/payments/full_card_request.h" | |
|
please use gerrit instead
2017/03/30 13:14:09
No need include this, because it's used only to im
anthonyvd
2017/03/30 15:43:41
Done.
| |
| 13 #include "components/payments/content/payment_request_dialog.h" | 14 #include "components/payments/content/payment_request_dialog.h" |
| 14 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 15 | 16 |
| 16 namespace payments { | 17 namespace payments { |
| 17 | 18 |
| 19 class CvcUnmaskUIDelegate; | |
| 20 class CvcUnmaskViewController; | |
|
please use gerrit instead
2017/03/30 13:14:09
Can these two be made private? Then in the .cc fil
anthonyvd
2017/03/30 15:43:41
I'm not sure what you mean. I'm just forward decla
please use gerrit instead
2017/03/31 14:41:14
CvcUnmaskUIDelegate is used only as a private vari
anthonyvd
2017/04/04 13:25:22
Thanks for the details, this comment is now obsole
| |
| 18 class PaymentRequest; | 21 class PaymentRequest; |
| 19 class PaymentRequestSheetController; | 22 class PaymentRequestSheetController; |
| 20 | 23 |
| 21 // Maps views owned by PaymentRequestDialogView::view_stack_ to their | 24 // Maps views owned by PaymentRequestDialogView::view_stack_ to their |
| 22 // controller. PaymentRequestDialogView is responsible for listening for those | 25 // controller. PaymentRequestDialogView is responsible for listening for those |
| 23 // views being removed from the hierarchy and delete the associated controllers. | 26 // views being removed from the hierarchy and delete the associated controllers. |
| 24 using ControllerMap = | 27 using ControllerMap = |
| 25 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; | 28 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; |
| 26 | 29 |
| 27 // The dialog delegate that represents a desktop WebPayments dialog. This class | 30 // The dialog delegate that represents a desktop WebPayments dialog. This class |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 ~PaymentRequestDialogView() override; | 64 ~PaymentRequestDialogView() override; |
| 62 | 65 |
| 63 // views::WidgetDelegate | 66 // views::WidgetDelegate |
| 64 ui::ModalType GetModalType() const override; | 67 ui::ModalType GetModalType() const override; |
| 65 | 68 |
| 66 // views::DialogDelegate | 69 // views::DialogDelegate |
| 67 bool Cancel() override; | 70 bool Cancel() override; |
| 68 bool ShouldShowCloseButton() const override; | 71 bool ShouldShowCloseButton() const override; |
| 69 int GetDialogButtons() const override; | 72 int GetDialogButtons() const override; |
| 70 | 73 |
| 71 // payments::PaymentRequestDialog | 74 // payments::PaymentRequestDialog |
|
please use gerrit instead
2017/03/30 13:14:09
No need to specify the "payments" namespace in thi
anthonyvd
2017/03/30 15:43:41
Done.
| |
| 72 void ShowDialog() override; | 75 void ShowDialog() override; |
| 73 void CloseDialog() override; | 76 void CloseDialog() override; |
| 74 void ShowErrorMessage() override; | 77 void ShowErrorMessage() override; |
| 78 base::WeakPtr<autofill::payments::FullCardRequest::UIDelegate> | |
| 79 GetFullCardRequestUIDelegate() override; | |
| 75 | 80 |
| 76 void Pay(); | 81 void Pay(); |
| 77 void GoBack(); | 82 void GoBack(); |
| 78 void ShowContactProfileSheet(); | 83 void ShowContactProfileSheet(); |
| 79 void ShowOrderSummary(); | 84 void ShowOrderSummary(); |
| 80 void ShowShippingProfileSheet(); | 85 void ShowShippingProfileSheet(); |
| 81 void ShowPaymentMethodSheet(); | 86 void ShowPaymentMethodSheet(); |
| 82 void ShowShippingOptionSheet(); | 87 void ShowShippingOptionSheet(); |
| 83 void ShowCreditCardEditor(); | 88 void ShowCreditCardEditor(); |
| 84 void ShowShippingAddressEditor(); | 89 void ShowShippingAddressEditor(); |
| 85 void EditorViewUpdated(); | 90 void EditorViewUpdated(); |
| 86 | 91 |
| 92 void ShowCvcUnmaskSheet( | |
| 93 std::unique_ptr<CvcUnmaskViewController> view_controller); | |
| 94 | |
| 87 ViewStack* view_stack_for_testing() { return &view_stack_; } | 95 ViewStack* view_stack_for_testing() { return &view_stack_; } |
| 88 | 96 |
| 89 private: | 97 private: |
| 90 void ShowInitialPaymentSheet(); | 98 void ShowInitialPaymentSheet(); |
| 91 | 99 |
| 92 // views::View | 100 // views::View |
| 93 gfx::Size GetPreferredSize() const override; | 101 gfx::Size GetPreferredSize() const override; |
| 94 void ViewHierarchyChanged( | 102 void ViewHierarchyChanged( |
| 95 const ViewHierarchyChangedDetails& details) override; | 103 const ViewHierarchyChangedDetails& details) override; |
| 96 | 104 |
| 97 // Non-owned reference to the PaymentRequest that initiated this dialog. Since | 105 // Non-owned reference to the PaymentRequest that initiated this dialog. Since |
| 98 // the PaymentRequest object always outlives this one, the pointer should | 106 // the PaymentRequest object always outlives this one, the pointer should |
| 99 // always be valid even though there is no direct ownership relationship | 107 // always be valid even though there is no direct ownership relationship |
| 100 // between the two. | 108 // between the two. |
| 101 PaymentRequest* request_; | 109 PaymentRequest* request_; |
| 102 ControllerMap controller_map_; | 110 ControllerMap controller_map_; |
| 103 ViewStack view_stack_; | 111 ViewStack view_stack_; |
| 104 | 112 |
| 105 // May be null. | 113 // May be null. |
| 106 ObserverForTest* observer_for_testing_; | 114 ObserverForTest* observer_for_testing_; |
| 107 | 115 |
| 108 // Used when the dialog is being closed to avoid re-entrancy into the | 116 // Used when the dialog is being closed to avoid re-entrancy into the |
| 109 // controller_map_. | 117 // controller_map_. |
| 110 bool being_closed_; | 118 bool being_closed_; |
| 111 | 119 |
| 120 std::unique_ptr<CvcUnmaskUIDelegate> cvc_unmask_ui_delegate_; | |
| 121 | |
| 112 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); | 122 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); |
| 113 }; | 123 }; |
| 114 | 124 |
| 115 } // namespace payments | 125 } // namespace payments |
| 116 | 126 |
| 117 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 127 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
| OLD | NEW |