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

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

Issue 2815723002: [Web Payments] Add Spinners and timeout while waiting for UpdateWith (Closed)
Patch Set: Address comments. Created 3 years, 8 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_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
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_) {
133 observer.OnStartUpdating(reason);
134 }
135 }
136
130 void PaymentRequestSpec::PopulateValidatedMethodData( 137 void PaymentRequestSpec::PopulateValidatedMethodData(
131 const std::vector<mojom::PaymentMethodDataPtr>& method_data_mojom) { 138 const std::vector<mojom::PaymentMethodDataPtr>& method_data_mojom) {
132 if (method_data_mojom.empty()) { 139 if (method_data_mojom.empty()) {
133 LOG(ERROR) << "Invalid payment methods or data"; 140 LOG(ERROR) << "Invalid payment methods or data";
134 NotifyOnInvalidSpecProvided(); 141 NotifyOnInvalidSpecProvided();
135 return; 142 return;
136 } 143 }
137 144
138 std::vector<PaymentMethodData> method_data_vector; 145 std::vector<PaymentMethodData> method_data_vector;
139 method_data_vector.reserve(method_data_mojom.size()); 146 method_data_vector.reserve(method_data_mojom.size());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 const std::string& currency_system, 211 const std::string& currency_system,
205 const std::string& locale_name) { 212 const std::string& locale_name) {
206 if (!currency_formatter_) { 213 if (!currency_formatter_) {
207 currency_formatter_.reset( 214 currency_formatter_.reset(
208 new CurrencyFormatter(currency_code, currency_system, locale_name)); 215 new CurrencyFormatter(currency_code, currency_system, locale_name));
209 } 216 }
210 return currency_formatter_.get(); 217 return currency_formatter_.get();
211 } 218 }
212 219
213 } // namespace payments 220 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_spec.h ('k') | components/payments/content/payment_request_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698