| 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 17 matching lines...) Expand all Loading... |
| 28 // is responsible for displaying the view associated with the current state of | 28 // is responsible for displaying the view associated with the current state of |
| 29 // the WebPayments flow and managing the transition between those states. | 29 // the WebPayments flow and managing the transition between those states. |
| 30 class PaymentRequestDialogView : public views::DialogDelegateView, | 30 class PaymentRequestDialogView : public views::DialogDelegateView, |
| 31 public PaymentRequestDialog { | 31 public PaymentRequestDialog { |
| 32 public: | 32 public: |
| 33 class ObserverForTest { | 33 class ObserverForTest { |
| 34 public: | 34 public: |
| 35 virtual void OnDialogOpened() = 0; | 35 virtual void OnDialogOpened() = 0; |
| 36 | 36 |
| 37 virtual void OnOrderSummaryOpened() = 0; | 37 virtual void OnOrderSummaryOpened() = 0; |
| 38 |
| 39 virtual void OnPaymentMethodOpened() = 0; |
| 40 |
| 41 virtual void OnCreditCardEditorOpened() = 0; |
| 42 |
| 43 virtual void OnBackNavigation() = 0; |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 // Build a Dialog around the PaymentRequest object. |observer| is used to | 46 // Build a Dialog around the PaymentRequest object. |observer| is used to |
| 41 // be notified of dialog events as they happen (but may be NULL) and should | 47 // be notified of dialog events as they happen (but may be NULL) and should |
| 42 // outlive this object. | 48 // outlive this object. |
| 43 PaymentRequestDialogView(PaymentRequest* request, | 49 PaymentRequestDialogView(PaymentRequest* request, |
| 44 PaymentRequestDialogView::ObserverForTest* observer); | 50 PaymentRequestDialogView::ObserverForTest* observer); |
| 45 ~PaymentRequestDialogView() override; | 51 ~PaymentRequestDialogView() override; |
| 46 | 52 |
| 47 // views::WidgetDelegate | 53 // views::WidgetDelegate |
| 48 ui::ModalType GetModalType() const override; | 54 ui::ModalType GetModalType() const override; |
| 49 | 55 |
| 50 // views::DialogDelegate | 56 // views::DialogDelegate |
| 51 bool Cancel() override; | 57 bool Cancel() override; |
| 52 bool ShouldShowCloseButton() const override; | 58 bool ShouldShowCloseButton() const override; |
| 53 int GetDialogButtons() const override; | 59 int GetDialogButtons() const override; |
| 54 | 60 |
| 55 // payments::PaymentRequestDialog | 61 // payments::PaymentRequestDialog |
| 56 void ShowDialog() override; | 62 void ShowDialog() override; |
| 57 void CloseDialog() override; | 63 void CloseDialog() override; |
| 58 | 64 |
| 59 void GoBack(); | 65 void GoBack(); |
| 60 void ShowOrderSummary(); | 66 void ShowOrderSummary(); |
| 61 void ShowShippingListSheet(); | 67 void ShowShippingListSheet(); |
| 62 void ShowPaymentMethodSheet(); | 68 void ShowPaymentMethodSheet(); |
| 69 void ShowCreditCardEditor(); |
| 70 |
| 71 ViewStack* view_stack_for_testing() { return &view_stack_; } |
| 63 | 72 |
| 64 private: | 73 private: |
| 65 void ShowInitialPaymentSheet(); | 74 void ShowInitialPaymentSheet(); |
| 66 | 75 |
| 67 // views::View | 76 // views::View |
| 68 gfx::Size GetPreferredSize() const override; | 77 gfx::Size GetPreferredSize() const override; |
| 69 void ViewHierarchyChanged( | 78 void ViewHierarchyChanged( |
| 70 const ViewHierarchyChangedDetails& details) override; | 79 const ViewHierarchyChangedDetails& details) override; |
| 71 | 80 |
| 72 // Non-owned reference to the PaymentRequest that initiated this dialog. Since | 81 // Non-owned reference to the PaymentRequest that initiated this dialog. Since |
| 73 // the PaymentRequest object always outlives this one, the pointer should | 82 // the PaymentRequest object always outlives this one, the pointer should |
| 74 // always be valid even though there is no direct ownership relationship | 83 // always be valid even though there is no direct ownership relationship |
| 75 // between the two. | 84 // between the two. |
| 76 PaymentRequest* request_; | 85 PaymentRequest* request_; |
| 77 ControllerMap controller_map_; | 86 ControllerMap controller_map_; |
| 78 ViewStack view_stack_; | 87 ViewStack view_stack_; |
| 79 | 88 |
| 80 // May be null. | 89 // May be null. |
| 81 ObserverForTest* observer_for_testing_; | 90 ObserverForTest* observer_for_testing_; |
| 82 | 91 |
| 83 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); | 92 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); |
| 84 }; | 93 }; |
| 85 | 94 |
| 86 } // namespace payments | 95 } // namespace payments |
| 87 | 96 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
| OLD | NEW |