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

Side by Side Diff: components/payments/content/payment_request.cc

Issue 2730123002: [Web Payments] Add inline items to the Order Summary section. (Closed)
Patch Set: Address comments. Created 3 years, 9 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
« no previous file with comments | « components/payments/content/payment_request.h ('k') | components/payments_strings.grdp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/payments/content/payment_request.h" 5 #include "components/payments/content/payment_request.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const std::string& currency_code, 128 const std::string& currency_code,
129 const std::string& currency_system, 129 const std::string& currency_system,
130 const std::string& locale_name) { 130 const std::string& locale_name) {
131 if (!currency_formatter_) { 131 if (!currency_formatter_) {
132 currency_formatter_.reset( 132 currency_formatter_.reset(
133 new CurrencyFormatter(currency_code, currency_system, locale_name)); 133 new CurrencyFormatter(currency_code, currency_system, locale_name));
134 } 134 }
135 return currency_formatter_.get(); 135 return currency_formatter_.get();
136 } 136 }
137 137
138 base::string16 PaymentRequest::GetFormattedCurrencyAmount(
139 const std::string& amount) {
140 CurrencyFormatter* formatter =
141 GetOrCreateCurrencyFormatter(details()->total->amount->currency,
142 details()->total->amount->currency_system,
143 delegate_->GetApplicationLocale());
144 return formatter->Format(amount);
145 }
146
147 std::string PaymentRequest::GetFormattedCurrencyCode() {
148 CurrencyFormatter* formatter =
149 GetOrCreateCurrencyFormatter(details()->total->amount->currency,
150 details()->total->amount->currency_system,
151 delegate_->GetApplicationLocale());
152
153 return formatter->formatted_currency_code();
154 }
155
138 void PaymentRequest::SetSelectedShippingProfile( 156 void PaymentRequest::SetSelectedShippingProfile(
139 autofill::AutofillProfile* profile) { 157 autofill::AutofillProfile* profile) {
140 selected_shipping_profile_ = profile; 158 selected_shipping_profile_ = profile;
141 UpdateIsReadyToPayAndNotifyObservers(); 159 UpdateIsReadyToPayAndNotifyObservers();
142 } 160 }
143 161
144 void PaymentRequest::SetSelectedContactProfile( 162 void PaymentRequest::SetSelectedContactProfile(
145 autofill::AutofillProfile* profile) { 163 autofill::AutofillProfile* profile) {
146 selected_contact_profile_ = profile; 164 selected_contact_profile_ = profile;
147 UpdateIsReadyToPayAndNotifyObservers(); 165 UpdateIsReadyToPayAndNotifyObservers();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), 342 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER),
325 app_locale) 343 app_locale)
326 .empty())) { 344 .empty())) {
327 return false; 345 return false;
328 } 346 }
329 347
330 return true; 348 return true;
331 } 349 }
332 350
333 } // namespace payments 351 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request.h ('k') | components/payments_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698