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

Side by Side Diff: chrome/browser/ui/views/payments/order_summary_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/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 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 24 matching lines...) Expand all
35 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); 35 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>();
36 36
37 views::GridLayout* layout = new views::GridLayout(content_view.get()); 37 views::GridLayout* layout = new views::GridLayout(content_view.get());
38 content_view->SetLayoutManager(layout); 38 content_view->SetLayoutManager(layout);
39 views::ColumnSet* columns = layout->AddColumnSet(0); 39 views::ColumnSet* columns = layout->AddColumnSet(0);
40 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 40 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
41 0, views::GridLayout::USE_PREF, 0, 0); 41 0, views::GridLayout::USE_PREF, 0, 0);
42 42
43 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( 43 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter(
44 request()->details()->total->amount->currency, 44 request()->details()->total->amount->currency,
45 request()->details()->total->amount->currencySystem, 45 request()->details()->total->amount->currency_system,
46 g_browser_process->GetApplicationLocale()); 46 g_browser_process->GetApplicationLocale());
47 layout->StartRow(0, 0); 47 layout->StartRow(0, 0);
48 layout->AddView(new views::Label(l10n_util::GetStringFUTF16( 48 layout->AddView(new views::Label(l10n_util::GetStringFUTF16(
49 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT, 49 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT,
50 base::UTF8ToUTF16(request()->details()->total->label), 50 base::UTF8ToUTF16(request()->details()->total->label),
51 base::UTF8ToUTF16(request()->details()->total->amount->currency), 51 base::UTF8ToUTF16(formatter->formatted_currency_code()),
52 formatter->Format(request()->details()->total->amount->value)))); 52 formatter->Format(request()->details()->total->amount->value))));
53 53
54 return payments::CreatePaymentView( 54 return payments::CreatePaymentView(
55 CreateSheetHeaderView( 55 CreateSheetHeaderView(
56 true, 56 true,
57 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE), 57 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE),
58 this), 58 this),
59 std::move(content_view)); 59 std::move(content_view));
60 } 60 }
61 61
62 void OrderSummaryViewController::ButtonPressed( 62 void OrderSummaryViewController::ButtonPressed(
63 views::Button* sender, const ui::Event& event) { 63 views::Button* sender, const ui::Event& event) {
64 switch (sender->tag()) { 64 switch (sender->tag()) {
65 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): 65 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG):
66 dialog()->CloseDialog(); 66 dialog()->CloseDialog();
67 break; 67 break;
68 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG): 68 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG):
69 dialog()->GoBack(); 69 dialog()->GoBack();
70 break; 70 break;
71 default: 71 default:
72 NOTREACHED(); 72 NOTREACHED();
73 } 73 }
74 } 74 }
75 75
76 } // namespace payments 76 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698