| 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_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ |
| 6 #define CHROME_BROWSER_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ | 6 #define CHROME_BROWSER_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/payments/ui/order_summary_state.h" |
| 9 #include "chrome/browser/payments/ui/payment_dialog_state.h" |
| 10 #include "chrome/browser/payments/ui/payment_sheet_state.h" |
| 8 #include "components/payments/payment_request.mojom.h" | 11 #include "components/payments/payment_request.mojom.h" |
| 12 #include "ui/views/animation/bounds_animator.h" |
| 9 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 10 #include "ui/views/window/dialog_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
| 11 | 15 |
| 12 namespace payments { | 16 namespace payments { |
| 13 | 17 |
| 14 class PaymentRequestDialog : public views::DialogDelegateView { | 18 class PaymentRequestDialog : public views::DialogDelegateView, |
| 19 public PaymentSheetState::Observer, |
| 20 public OrderSummaryState::Observer { |
| 15 public: | 21 public: |
| 16 explicit PaymentRequestDialog( | 22 explicit PaymentRequestDialog( |
| 17 payments::mojom::PaymentRequestClientPtr client); | 23 payments::mojom::PaymentRequestClientPtr client); |
| 18 ~PaymentRequestDialog() override; | 24 ~PaymentRequestDialog() override; |
| 19 | 25 |
| 26 void PushState(std::unique_ptr<PaymentDialogState> state); |
| 27 void PopState(); |
| 28 |
| 20 // views::WidgetDelegate | 29 // views::WidgetDelegate |
| 21 ui::ModalType GetModalType() const override; | 30 ui::ModalType GetModalType() const override; |
| 22 | 31 |
| 23 // views::View | 32 // views::View |
| 24 gfx::Size GetPreferredSize() const override; | 33 gfx::Size GetPreferredSize() const override; |
| 25 | 34 |
| 26 // views::DialogDelegate | 35 // views::DialogDelegate |
| 27 bool Cancel() override; | 36 bool Cancel() override; |
| 28 | 37 |
| 38 // PaymentSheetState::Observer: |
| 39 void OnOrderSummaryClicked() override; |
| 40 |
| 41 // OrderSummaryState::Observer: |
| 42 void OnBackClicked() override; |
| 43 |
| 29 private: | 44 private: |
| 30 payments::mojom::PaymentRequestClientPtr client_; | 45 payments::mojom::PaymentRequestClientPtr client_; |
| 31 std::unique_ptr<views::Label> label_; | 46 std::unique_ptr<views::BoundsAnimator> slide_in_animator_; |
| 47 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; |
| 48 |
| 49 std::stack<std::unique_ptr<PaymentDialogState> > state_stack_; |
| 32 | 50 |
| 33 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); | 51 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); |
| 34 }; | 52 }; |
| 35 | 53 |
| 36 } // namespace payments | 54 } // namespace payments |
| 37 | 55 |
| 38 #endif // CHROME_BROWSER_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ | 56 #endif // CHROME_BROWSER_PAYMENTS_UI_PAYMENT_REQUEST_DIALOG_H_ |
| OLD | NEW |