Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc

Issue 2637603002: [Payments] Use formatter currency code on desktop (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/payment_sheet_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 break; 154 break;
155 default: 155 default:
156 NOTREACHED(); 156 NOTREACHED();
157 } 157 }
158 } 158 }
159 159
160 std::unique_ptr<views::View> 160 std::unique_ptr<views::View>
161 PaymentSheetViewController::CreateOrderSummarySectionContent() { 161 PaymentSheetViewController::CreateOrderSummarySectionContent() {
162 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( 162 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter(
163 request()->details()->total->amount->currency, 163 request()->details()->total->amount->currency,
164 request()->details()->total->amount->currencySystem, 164 request()->details()->total->amount->currency_system,
165 g_browser_process->GetApplicationLocale()); 165 g_browser_process->GetApplicationLocale());
166 base::string16 label_value = l10n_util::GetStringFUTF16( 166 base::string16 label_value = l10n_util::GetStringFUTF16(
167 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT, 167 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT,
168 base::UTF8ToUTF16(request()->details()->total->label), 168 base::UTF8ToUTF16(request()->details()->total->label),
169 base::UTF8ToUTF16(request()->details()->total->amount->currency), 169 base::UTF8ToUTF16(formatter->formatted_currency_code()),
170 formatter->Format(request()->details()->total->amount->value)); 170 formatter->Format(request()->details()->total->amount->value));
171 171
172 return base::MakeUnique<views::Label>(label_value); 172 return base::MakeUnique<views::Label>(label_value);
173 } 173 }
174 174
175 std::unique_ptr<views::Button> 175 std::unique_ptr<views::Button>
176 PaymentSheetViewController::CreatePaymentSheetSummaryRow() { 176 PaymentSheetViewController::CreatePaymentSheetSummaryRow() {
177 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 177 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>(
178 this, 178 this,
179 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME), 179 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME),
180 std::unique_ptr<views::View>(nullptr), 180 std::unique_ptr<views::View>(nullptr),
181 CreateOrderSummarySectionContent()); 181 CreateOrderSummarySectionContent());
182 section->set_tag(static_cast<int>( 182 section->set_tag(static_cast<int>(
183 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); 183 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON));
184 return section; 184 return section;
185 } 185 }
186 186
187 } // namespace payments 187 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/order_summary_view_controller.cc ('k') | components/payments/payment_details_validation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698