| 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_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ |
| 7 | 7 |
| 8 #include "ui/views/controls/label.h" | 8 #include "ui/views/controls/button/button.h" |
| 9 #include "ui/views/window/dialog_delegate.h" | 9 #include "ui/views/window/dialog_delegate.h" |
| 10 | 10 |
| 11 class ViewStack; |
| 12 |
| 11 namespace payments { | 13 namespace payments { |
| 12 | 14 |
| 13 class PaymentRequestImpl; | 15 class PaymentRequestImpl; |
| 14 | 16 |
| 15 // The dialog delegate that represents a desktop WebPayments dialog. This class | 17 // The dialog delegate that represents a desktop WebPayments dialog. This class |
| 16 // is responsible for displaying the view associated with the current state of | 18 // is responsible for displaying the view associated with the current state of |
| 17 // the WebPayments flow and managing the transition between those states. | 19 // the WebPayments flow and managing the transition between those states. |
| 18 class PaymentRequestDialog : public views::DialogDelegateView { | 20 class PaymentRequestDialog : public views::DialogDelegateView, |
| 21 public views::ButtonListener { |
| 19 public: | 22 public: |
| 20 explicit PaymentRequestDialog(PaymentRequestImpl* impl); | 23 explicit PaymentRequestDialog(PaymentRequestImpl* impl); |
| 21 ~PaymentRequestDialog() override; | 24 ~PaymentRequestDialog() override; |
| 22 | 25 |
| 23 // views::WidgetDelegate: | 26 // views::WidgetDelegate |
| 24 ui::ModalType GetModalType() const override; | 27 ui::ModalType GetModalType() const override; |
| 25 | 28 |
| 26 // views::View: | 29 // views::View |
| 27 gfx::Size GetPreferredSize() const override; | 30 gfx::Size GetPreferredSize() const override; |
| 28 | 31 |
| 29 // views::DialogDelegate: | 32 // views::DialogDelegate |
| 30 bool Cancel() override; | 33 bool Cancel() override; |
| 31 | 34 |
| 32 private: | 35 private: |
| 36 // views::ButtonListener: |
| 37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 38 |
| 39 void ShowOrderSummary(); |
| 40 void GoBack(); |
| 41 |
| 33 // Non-owned reference to the PaymentRequestImpl that initiated this dialog. | 42 // Non-owned reference to the PaymentRequestImpl that initiated this dialog. |
| 34 // Since the PaymentRequestImpl object always outlives this one, the pointer | 43 // Since the PaymentRequestImpl object always outlives this one, the pointer |
| 35 // should always be valid even though there is no direct ownership | 44 // should always be valid even though there is no direct ownership |
| 36 // relationship between the two. | 45 // relationship between the two. |
| 37 PaymentRequestImpl* impl_; | 46 PaymentRequestImpl* impl_; |
| 38 std::unique_ptr<views::Label> label_; | 47 std::unique_ptr<ViewStack> view_stack_; |
| 39 | 48 |
| 40 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); | 49 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); |
| 41 }; | 50 }; |
| 42 | 51 |
| 43 } // namespace payments | 52 } // namespace payments |
| 44 | 53 |
| 45 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ | 54 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ |
| OLD | NEW |