| 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_SHEET_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | 11 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| 12 #include "components/payments/content/payment_request.h" | 12 #include "components/payments/content/payment_request.h" |
| 13 #include "components/payments/content/payment_request_state.h" |
| 13 | 14 |
| 14 namespace payments { | 15 namespace payments { |
| 15 | 16 |
| 16 class PaymentRequest; | 17 class PaymentRequest; |
| 17 class PaymentRequestDialogView; | 18 class PaymentRequestDialogView; |
| 18 | 19 |
| 19 // The PaymentRequestSheetController subtype for the Payment Sheet screen of the | 20 // The PaymentRequestSheetController subtype for the Payment Sheet screen of the |
| 20 // Payment Request dialog. | 21 // Payment Request dialog. |
| 21 class PaymentSheetViewController : public PaymentRequestSheetController, | 22 class PaymentSheetViewController : public PaymentRequestSheetController, |
| 22 public PaymentRequest::Observer { | 23 public PaymentRequestState::Observer { |
| 23 public: | 24 public: |
| 24 // Does not take ownership of the arguments, which should outlive this object. | 25 // Does not take ownership of the arguments, which should outlive this object. |
| 25 PaymentSheetViewController(PaymentRequest* request, | 26 PaymentSheetViewController(PaymentRequest* request, |
| 26 PaymentRequestDialogView* dialog); | 27 PaymentRequestDialogView* dialog); |
| 27 ~PaymentSheetViewController() override; | 28 ~PaymentSheetViewController() override; |
| 28 | 29 |
| 29 // PaymentRequestSheetController: | 30 // PaymentRequestSheetController: |
| 30 std::unique_ptr<views::View> CreateView() override; | 31 std::unique_ptr<views::View> CreateView() override; |
| 31 | 32 |
| 32 // PaymentRequest::Observer: | 33 // PaymentRequestState::Observer: |
| 33 void OnSelectedInformationChanged() override; | 34 void OnSelectedInformationChanged() override; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 // PaymentRequestSheetController: | 37 // PaymentRequestSheetController: |
| 37 std::unique_ptr<views::Button> CreatePrimaryButton() override; | 38 std::unique_ptr<views::Button> CreatePrimaryButton() override; |
| 38 std::unique_ptr<views::View> CreateExtraFooterView() override; | 39 std::unique_ptr<views::View> CreateExtraFooterView() override; |
| 39 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 40 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 40 | 41 |
| 41 void UpdatePayButtonState(bool enabled); | 42 void UpdatePayButtonState(bool enabled); |
| 42 | 43 |
| 43 std::unique_ptr<views::View> CreateShippingSectionContent(); | 44 std::unique_ptr<views::View> CreateShippingSectionContent(); |
| 44 std::unique_ptr<views::Button> CreateShippingRow(); | 45 std::unique_ptr<views::Button> CreateShippingRow(); |
| 45 std::unique_ptr<views::Button> CreatePaymentSheetSummaryRow(); | 46 std::unique_ptr<views::Button> CreatePaymentSheetSummaryRow(); |
| 46 std::unique_ptr<views::Button> CreatePaymentMethodRow(); | 47 std::unique_ptr<views::Button> CreatePaymentMethodRow(); |
| 47 std::unique_ptr<views::View> CreateContactInfoSectionContent(); | 48 std::unique_ptr<views::View> CreateContactInfoSectionContent(); |
| 48 std::unique_ptr<views::Button> CreateContactInfoRow(); | 49 std::unique_ptr<views::Button> CreateContactInfoRow(); |
| 49 std::unique_ptr<views::View> CreateShippingOptionContent(); | |
| 50 std::unique_ptr<views::Button> CreateShippingOptionRow(); | 50 std::unique_ptr<views::Button> CreateShippingOptionRow(); |
| 51 | 51 |
| 52 views::Button* pay_button_; | 52 views::Button* pay_button_; |
| 53 | 53 |
| 54 const int widest_name_column_view_width_; | 54 const int widest_name_column_view_width_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(PaymentSheetViewController); | 56 DISALLOW_COPY_AND_ASSIGN(PaymentSheetViewController); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace payments | 59 } // namespace payments |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ | 61 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ |
| OLD | NEW |