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

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: Rebase 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
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
138 void PaymentRequest::SetSelectedShippingProfile( 147 void PaymentRequest::SetSelectedShippingProfile(
139 autofill::AutofillProfile* profile) { 148 autofill::AutofillProfile* profile) {
140 selected_shipping_profile_ = profile; 149 selected_shipping_profile_ = profile;
141 UpdateIsReadyToPayAndNotifyObservers(); 150 UpdateIsReadyToPayAndNotifyObservers();
142 } 151 }
143 152
144 void PaymentRequest::SetSelectedContactProfile( 153 void PaymentRequest::SetSelectedContactProfile(
145 autofill::AutofillProfile* profile) { 154 autofill::AutofillProfile* profile) {
146 selected_contact_profile_ = profile; 155 selected_contact_profile_ = profile;
147 UpdateIsReadyToPayAndNotifyObservers(); 156 UpdateIsReadyToPayAndNotifyObservers();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), 333 ->GetInfo(autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER),
325 app_locale) 334 app_locale)
326 .empty())) { 335 .empty())) {
327 return false; 336 return false;
328 } 337 }
329 338
330 return true; 339 return true;
331 } 340 }
332 341
333 } // namespace payments 342 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698