| 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 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 DialogViewID::ORDER_SUMMARY_LINE_ITEM_2, | 111 DialogViewID::ORDER_SUMMARY_LINE_ITEM_2, |
| 112 DialogViewID::ORDER_SUMMARY_LINE_ITEM_3}; | 112 DialogViewID::ORDER_SUMMARY_LINE_ITEM_3}; |
| 113 for (size_t i = 0; i < request()->spec()->details().display_items.size(); | 113 for (size_t i = 0; i < request()->spec()->details().display_items.size(); |
| 114 i++) { | 114 i++) { |
| 115 DialogViewID view_id = | 115 DialogViewID view_id = |
| 116 i < line_items.size() ? line_items[i] : DialogViewID::VIEW_ID_NONE; | 116 i < line_items.size() ? line_items[i] : DialogViewID::VIEW_ID_NONE; |
| 117 content_view->AddChildView( | 117 content_view->AddChildView( |
| 118 CreateLineItemView( | 118 CreateLineItemView( |
| 119 base::UTF8ToUTF16( | 119 base::UTF8ToUTF16( |
| 120 request()->spec()->details().display_items[i]->label), | 120 request()->spec()->details().display_items[i]->label), |
| 121 request()->GetFormattedCurrencyAmount( | 121 request()->spec()->GetFormattedCurrencyAmount( |
| 122 request()->spec()->details().display_items[i]->amount->value), | 122 request()->spec()->details().display_items[i]->amount->value), |
| 123 false, view_id) | 123 false, view_id) |
| 124 .release()); | 124 .release()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 base::string16 total_label_value = l10n_util::GetStringFUTF16( | 127 base::string16 total_label_value = l10n_util::GetStringFUTF16( |
| 128 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SHEET_TOTAL_FORMAT, | 128 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SHEET_TOTAL_FORMAT, |
| 129 base::UTF8ToUTF16(request()->spec()->details().total->amount->currency), | 129 base::UTF8ToUTF16(request()->spec()->details().total->amount->currency), |
| 130 request()->GetFormattedCurrencyAmount( | 130 request()->spec()->GetFormattedCurrencyAmount( |
| 131 request()->spec()->details().total->amount->value)); | 131 request()->spec()->details().total->amount->value)); |
| 132 | 132 |
| 133 content_view->AddChildView( | 133 content_view->AddChildView( |
| 134 CreateLineItemView( | 134 CreateLineItemView( |
| 135 base::UTF8ToUTF16(request()->spec()->details().total->label), | 135 base::UTF8ToUTF16(request()->spec()->details().total->label), |
| 136 total_label_value, true, | 136 total_label_value, true, |
| 137 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) | 137 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) |
| 138 .release()); | 138 .release()); |
| 139 | 139 |
| 140 return CreatePaymentView( | 140 return CreatePaymentView( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 159 | 159 |
| 160 void OrderSummaryViewController::OnSelectedInformationChanged() { | 160 void OrderSummaryViewController::OnSelectedInformationChanged() { |
| 161 UpdatePayButtonState(request()->state()->is_ready_to_pay()); | 161 UpdatePayButtonState(request()->state()->is_ready_to_pay()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { | 164 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { |
| 165 pay_button_->SetEnabled(enabled); | 165 pay_button_->SetEnabled(enabled); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace payments | 168 } // namespace payments |
| OLD | NEW |