| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 8 #include "components/payments/content/payment_request.h" | 8 #include "components/payments/content/payment_request.h" |
| 9 #include "components/payments/content/payment_request_spec.h" |
| 9 | 10 |
| 10 namespace payments { | 11 namespace payments { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 class ShippingOptionItem : public PaymentRequestItemList::Item { | 15 class ShippingOptionItem : public PaymentRequestItemList::Item { |
| 15 public: | 16 public: |
| 16 ShippingOptionItem(payments::mojom::PaymentShippingOption* shipping_option, | 17 ShippingOptionItem(payments::mojom::PaymentShippingOption* shipping_option, |
| 17 PaymentRequest* request, | 18 PaymentRequest* request, |
| 18 PaymentRequestItemList* parent_list, | 19 PaymentRequestItemList* parent_list, |
| 19 bool selected) | 20 bool selected) |
| 20 : PaymentRequestItemList::Item(request, parent_list, selected), | 21 : PaymentRequestItemList::Item(request, parent_list, selected), |
| 21 shipping_option_(shipping_option) {} | 22 shipping_option_(shipping_option) {} |
| 22 ~ShippingOptionItem() override {} | 23 ~ShippingOptionItem() override {} |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 // payments::PaymentRequestItemList::Item: | 26 // payments::PaymentRequestItemList::Item: |
| 26 std::unique_ptr<views::View> CreateItemView() override { | 27 std::unique_ptr<views::View> CreateItemView() override { |
| 27 return CreateShippingOptionLabel( | 28 return CreateShippingOptionLabel( |
| 28 shipping_option_, | 29 shipping_option_, request()->spec()->GetFormattedCurrencyAmount( |
| 29 request()->GetFormattedCurrencyAmount(shipping_option_->amount->value)); | 30 shipping_option_->amount->value)); |
| 30 } | 31 } |
| 31 | 32 |
| 32 void SelectedStateChanged() override {} | 33 void SelectedStateChanged() override {} |
| 33 | 34 |
| 34 mojom::PaymentShippingOption* shipping_option_; | 35 mojom::PaymentShippingOption* shipping_option_; |
| 35 | 36 |
| 36 DISALLOW_COPY_AND_ASSIGN(ShippingOptionItem); | 37 DISALLOW_COPY_AND_ASSIGN(ShippingOptionItem); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace | 40 } // namespace |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 this), | 62 this), |
| 62 std::move(list_view)); | 63 std::move(list_view)); |
| 63 } | 64 } |
| 64 | 65 |
| 65 std::unique_ptr<views::View> | 66 std::unique_ptr<views::View> |
| 66 ShippingOptionViewController::CreateExtraFooterView() { | 67 ShippingOptionViewController::CreateExtraFooterView() { |
| 67 return nullptr; | 68 return nullptr; |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace payments | 71 } // namespace payments |
| OLD | NEW |