Chromium Code Reviews| 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 "components/payments/content/payment_request_spec.h" | 5 #include "components/payments/content/payment_request_spec.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/payments/core/payment_method_data.h" | 10 #include "components/payments/core/payment_method_data.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 } | 120 } |
| 121 | 121 |
| 122 std::string PaymentRequestSpec::GetFormattedCurrencyCode() { | 122 std::string PaymentRequestSpec::GetFormattedCurrencyCode() { |
| 123 CurrencyFormatter* formatter = GetOrCreateCurrencyFormatter( | 123 CurrencyFormatter* formatter = GetOrCreateCurrencyFormatter( |
| 124 details_->total->amount->currency, | 124 details_->total->amount->currency, |
| 125 details_->total->amount->currency_system, app_locale_); | 125 details_->total->amount->currency_system, app_locale_); |
| 126 | 126 |
| 127 return formatter->formatted_currency_code(); | 127 return formatter->formatted_currency_code(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void PaymentRequestSpec::StartWaitingForUpdateWith( | |
| 131 PaymentRequestSpec::UpdateReason reason) { | |
| 132 for (auto& observer : observers_) | |
|
please use gerrit instead
2017/04/13 15:04:59
Need {}.
anthonyvd
2017/04/13 21:05:59
Done.
| |
| 133 observer.OnStartUpdating(reason); | |
| 134 } | |
| 135 | |
| 130 void PaymentRequestSpec::PopulateValidatedMethodData( | 136 void PaymentRequestSpec::PopulateValidatedMethodData( |
| 131 const std::vector<mojom::PaymentMethodDataPtr>& method_data_mojom) { | 137 const std::vector<mojom::PaymentMethodDataPtr>& method_data_mojom) { |
| 132 if (method_data_mojom.empty()) { | 138 if (method_data_mojom.empty()) { |
| 133 LOG(ERROR) << "Invalid payment methods or data"; | 139 LOG(ERROR) << "Invalid payment methods or data"; |
| 134 NotifyOnInvalidSpecProvided(); | 140 NotifyOnInvalidSpecProvided(); |
| 135 return; | 141 return; |
| 136 } | 142 } |
| 137 | 143 |
| 138 std::vector<PaymentMethodData> method_data_vector; | 144 std::vector<PaymentMethodData> method_data_vector; |
| 139 method_data_vector.reserve(method_data_mojom.size()); | 145 method_data_vector.reserve(method_data_mojom.size()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 const std::string& currency_system, | 210 const std::string& currency_system, |
| 205 const std::string& locale_name) { | 211 const std::string& locale_name) { |
| 206 if (!currency_formatter_) { | 212 if (!currency_formatter_) { |
| 207 currency_formatter_.reset( | 213 currency_formatter_.reset( |
| 208 new CurrencyFormatter(currency_code, currency_system, locale_name)); | 214 new CurrencyFormatter(currency_code, currency_system, locale_name)); |
| 209 } | 215 } |
| 210 return currency_formatter_.get(); | 216 return currency_formatter_.get(); |
| 211 } | 217 } |
| 212 | 218 |
| 213 } // namespace payments | 219 } // namespace payments |
| OLD | NEW |