| 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_spec.h" | 12 #include "components/payments/content/payment_request_spec.h" |
| 13 #include "components/payments/content/payment_request_state.h" | 13 #include "components/payments/content/payment_request_state.h" |
| 14 #include "ui/views/controls/styled_label_listener.h" |
| 15 |
| 16 namespace views { |
| 17 class StyledLabel; |
| 18 } |
| 14 | 19 |
| 15 namespace payments { | 20 namespace payments { |
| 16 | 21 |
| 17 class PaymentRequestDialogView; | 22 class PaymentRequestDialogView; |
| 18 | 23 |
| 19 // The PaymentRequestSheetController subtype for the Payment Sheet screen of the | 24 // The PaymentRequestSheetController subtype for the Payment Sheet screen of the |
| 20 // Payment Request dialog. | 25 // Payment Request dialog. |
| 21 class PaymentSheetViewController : public PaymentRequestSheetController, | 26 class PaymentSheetViewController : public PaymentRequestSheetController, |
| 22 public PaymentRequestSpec::Observer, | 27 public PaymentRequestSpec::Observer, |
| 23 public PaymentRequestState::Observer { | 28 public PaymentRequestState::Observer, |
| 29 public views::StyledLabelListener { |
| 24 public: | 30 public: |
| 25 // Does not take ownership of the arguments, which should outlive this object. | 31 // Does not take ownership of the arguments, which should outlive this object. |
| 26 PaymentSheetViewController(PaymentRequestSpec* spec, | 32 PaymentSheetViewController(PaymentRequestSpec* spec, |
| 27 PaymentRequestState* state, | 33 PaymentRequestState* state, |
| 28 PaymentRequestDialogView* dialog); | 34 PaymentRequestDialogView* dialog); |
| 29 ~PaymentSheetViewController() override; | 35 ~PaymentSheetViewController() override; |
| 30 | 36 |
| 31 // PaymentRequestSpec::Observer: | 37 // PaymentRequestSpec::Observer: |
| 32 void OnStartUpdating(PaymentRequestSpec::UpdateReason reason) override; | 38 void OnStartUpdating(PaymentRequestSpec::UpdateReason reason) override; |
| 33 void OnSpecUpdated() override; | 39 void OnSpecUpdated() override; |
| 34 | 40 |
| 35 // PaymentRequestState::Observer: | 41 // PaymentRequestState::Observer: |
| 36 void OnSelectedInformationChanged() override; | 42 void OnSelectedInformationChanged() override; |
| 37 | 43 |
| 38 private: | 44 private: |
| 39 // PaymentRequestSheetController: | 45 // PaymentRequestSheetController: |
| 40 std::unique_ptr<views::Button> CreatePrimaryButton() override; | 46 std::unique_ptr<views::Button> CreatePrimaryButton() override; |
| 41 bool ShouldShowHeaderBackArrow() override; | 47 bool ShouldShowHeaderBackArrow() override; |
| 42 base::string16 GetSheetTitle() override; | 48 base::string16 GetSheetTitle() override; |
| 43 void FillContentView(views::View* content_view) override; | 49 void FillContentView(views::View* content_view) override; |
| 44 std::unique_ptr<views::View> CreateExtraFooterView() override; | 50 std::unique_ptr<views::View> CreateExtraFooterView() override; |
| 45 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 51 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 46 | 52 |
| 53 // views::StyledLabelListener: |
| 54 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 55 const gfx::Range& range, |
| 56 int event_flags) override; |
| 57 |
| 47 void UpdatePayButtonState(bool enabled); | 58 void UpdatePayButtonState(bool enabled); |
| 48 | 59 |
| 49 std::unique_ptr<views::View> CreateShippingSectionContent(); | 60 std::unique_ptr<views::View> CreateShippingSectionContent(); |
| 50 std::unique_ptr<views::Button> CreateShippingRow(); | 61 std::unique_ptr<views::Button> CreateShippingRow(); |
| 51 std::unique_ptr<views::Button> CreatePaymentSheetSummaryRow(); | 62 std::unique_ptr<views::Button> CreatePaymentSheetSummaryRow(); |
| 52 std::unique_ptr<views::Button> CreatePaymentMethodRow(); | 63 std::unique_ptr<views::Button> CreatePaymentMethodRow(); |
| 53 std::unique_ptr<views::View> CreateContactInfoSectionContent(); | 64 std::unique_ptr<views::View> CreateContactInfoSectionContent(); |
| 54 std::unique_ptr<views::Button> CreateContactInfoRow(); | 65 std::unique_ptr<views::Button> CreateContactInfoRow(); |
| 55 std::unique_ptr<views::Button> CreateShippingOptionRow(); | 66 std::unique_ptr<views::Button> CreateShippingOptionRow(); |
| 67 std::unique_ptr<views::View> CreateDataSourceRow(); |
| 56 | 68 |
| 57 views::Button* pay_button_; | 69 views::Button* pay_button_; |
| 58 | 70 |
| 59 const int widest_name_column_view_width_; | 71 const int widest_name_column_view_width_; |
| 60 PaymentRequestSpec::UpdateReason current_update_reason_; | 72 PaymentRequestSpec::UpdateReason current_update_reason_; |
| 61 | 73 |
| 62 DISALLOW_COPY_AND_ASSIGN(PaymentSheetViewController); | 74 DISALLOW_COPY_AND_ASSIGN(PaymentSheetViewController); |
| 63 }; | 75 }; |
| 64 | 76 |
| 65 } // namespace payments | 77 } // namespace payments |
| 66 | 78 |
| 67 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ | 79 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_SHEET_VIEW_CONTROLLER_H_ |
| OLD | NEW |