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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: Rebasing the fixes... Created 3 years, 10 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 "modules/payments/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ConditionalFeatures.h" 7 #include "bindings/core/v8/ConditionalFeatures.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 namespace blink { 122 namespace blink {
123 namespace { 123 namespace {
124 124
125 // If the website does not call complete() 60 seconds after show() has been 125 // If the website does not call complete() 60 seconds after show() has been
126 // resolved, then behave as if the website called complete("fail"). 126 // resolved, then behave as if the website called complete("fail").
127 static const int completeTimeoutSeconds = 60; 127 static const int completeTimeoutSeconds = 60;
128 128
129 // Validates ShippingOption or PaymentItem, which happen to have identical 129 // Validates ShippingOption or PaymentItem, which happen to have identical
130 // fields, except for "id", which is present only in ShippingOption. 130 // fields, except for "id", which is present only in ShippingOption.
131 template <typename T> 131 template <typename T>
132 void validateShippingOptionOrPaymentItem(const T& item, 132 void ValidateShippingOptionOrPaymentItem(const T& item,
133 ExceptionState& exceptionState) { 133 ExceptionState& exception_state) {
134 if (!item.hasLabel() || item.label().isEmpty()) { 134 /* DO NOT SUBMIT - merge conflict marker.
135 exceptionState.throwTypeError("Item label required"); 135 * Please spell |hasLabel| and |label| below. */
136 if (!item.hasLabel() || item.label().IsEmpty()) {
137 exception_state.ThrowTypeError("Item label required");
136 return; 138 return;
137 } 139 }
138 140
141 /* DO NOT SUBMIT - merge conflict marker.
142 * Please spell |hasAmount| below. */
139 if (!item.hasAmount()) { 143 if (!item.hasAmount()) {
140 exceptionState.throwTypeError("Currency amount required"); 144 exception_state.ThrowTypeError("Currency amount required");
141 return; 145 return;
142 } 146 }
143 147
148 /* DO NOT SUBMIT - merge conflict marker.
149 * Please spell |amount| below. */
144 if (!item.amount().hasCurrency()) { 150 if (!item.amount().hasCurrency()) {
145 exceptionState.throwTypeError("Currency code required"); 151 exception_state.ThrowTypeError("Currency code required");
146 return; 152 return;
147 } 153 }
148 154
149 if (!item.amount().hasValue()) { 155 if (!item.amount().hasValue()) {
150 exceptionState.throwTypeError("Currency value required"); 156 exception_state.ThrowTypeError("Currency value required");
151 return; 157 return;
152 } 158 }
153 159
154 String errorMessage; 160 String error_message;
155 if (!PaymentsValidators::isValidCurrencyCodeFormat( 161 if (!PaymentsValidators::IsValidCurrencyCodeFormat(
162 /* DO NOT SUBMIT - merge conflict marker.
163 * Please spell |amount| below. */
156 item.amount().currency(), item.amount().currencySystem(), 164 item.amount().currency(), item.amount().currencySystem(),
157 &errorMessage)) { 165 &error_message)) {
158 exceptionState.throwTypeError(errorMessage); 166 exception_state.ThrowTypeError(error_message);
159 return; 167 return;
160 } 168 }
161 169
162 if (!PaymentsValidators::isValidAmountFormat(item.amount().value(), 170 /* DO NOT SUBMIT - merge conflict marker.
163 &errorMessage)) { 171 * Please spell |amount| below. */
164 exceptionState.throwTypeError(errorMessage); 172 if (!PaymentsValidators::IsValidAmountFormat(item.amount().value(),
173 &error_message)) {
174 exception_state.ThrowTypeError(error_message);
165 return; 175 return;
166 } 176 }
167 } 177 }
168 178
169 void validateAndConvertDisplayItems(const HeapVector<PaymentItem>& input, 179 void validateAndConvertDisplayItems(const HeapVector<PaymentItem>& input,
170 Vector<PaymentItemPtr>& output, 180 Vector<PaymentItemPtr>& output,
171 ExceptionState& exceptionState) { 181 ExceptionState& exceptionState) {
172 for (const PaymentItem& item : input) { 182 for (const PaymentItem& item : input) {
173 validateShippingOptionOrPaymentItem(item, exceptionState); 183 validateShippingOptionOrPaymentItem(item, exceptionState);
174 if (exceptionState.hadException()) 184 if (exceptionState.hadException())
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 m_completeResolver.clear(); 1056 m_completeResolver.clear();
1047 m_showResolver.clear(); 1057 m_showResolver.clear();
1048 m_abortResolver.clear(); 1058 m_abortResolver.clear();
1049 m_canMakePaymentResolver.clear(); 1059 m_canMakePaymentResolver.clear();
1050 if (m_clientBinding.is_bound()) 1060 if (m_clientBinding.is_bound())
1051 m_clientBinding.Close(); 1061 m_clientBinding.Close();
1052 m_paymentProvider.reset(); 1062 m_paymentProvider.reset();
1053 } 1063 }
1054 1064
1055 } // namespace blink 1065 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698