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

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

Issue 1981903002: PaymentRequest: Rename 'currencyCode' to 'currency' in CurrencyAmount.idl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/JSONValuesForV8.h" 8 #include "bindings/core/v8/JSONValuesForV8.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 27 matching lines...) Expand all
38 using blink::mojom::blink::PaymentOptions; 38 using blink::mojom::blink::PaymentOptions;
39 using blink::mojom::blink::PaymentOptionsPtr; 39 using blink::mojom::blink::PaymentOptionsPtr;
40 using blink::mojom::blink::ShippingOption; 40 using blink::mojom::blink::ShippingOption;
41 using blink::mojom::blink::ShippingOptionPtr; 41 using blink::mojom::blink::ShippingOptionPtr;
42 42
43 template <> 43 template <>
44 struct TypeConverter<CurrencyAmountPtr, blink::CurrencyAmount> { 44 struct TypeConverter<CurrencyAmountPtr, blink::CurrencyAmount> {
45 static CurrencyAmountPtr Convert(const blink::CurrencyAmount& input) 45 static CurrencyAmountPtr Convert(const blink::CurrencyAmount& input)
46 { 46 {
47 CurrencyAmountPtr output = CurrencyAmount::New(); 47 CurrencyAmountPtr output = CurrencyAmount::New();
48 output->currency_code = input.currencyCode(); 48 output->currency_code = input.currency();
49 output->value = input.value(); 49 output->value = input.value();
50 return output; 50 return output;
51 } 51 }
52 }; 52 };
53 53
54 template <> 54 template <>
55 struct TypeConverter<PaymentItemPtr, blink::PaymentItem> { 55 struct TypeConverter<PaymentItemPtr, blink::PaymentItem> {
56 static PaymentItemPtr Convert(const blink::PaymentItem& input) 56 static PaymentItemPtr Convert(const blink::PaymentItem& input)
57 { 57 {
58 PaymentItemPtr output = PaymentItem::New(); 58 PaymentItemPtr output = PaymentItem::New();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!item.hasLabel() || item.label().isEmpty()) { 118 if (!item.hasLabel() || item.label().isEmpty()) {
119 exceptionState.throwTypeError("Item label required"); 119 exceptionState.throwTypeError("Item label required");
120 return; 120 return;
121 } 121 }
122 122
123 if (!item.hasAmount()) { 123 if (!item.hasAmount()) {
124 exceptionState.throwTypeError("Currency amount required"); 124 exceptionState.throwTypeError("Currency amount required");
125 return; 125 return;
126 } 126 }
127 127
128 if (!item.amount().hasCurrencyCode()) { 128 if (!item.amount().hasCurrency()) {
129 exceptionState.throwTypeError("Currency code required"); 129 exceptionState.throwTypeError("Currency code required");
130 return; 130 return;
131 } 131 }
132 132
133 if (!item.amount().hasValue()) { 133 if (!item.amount().hasValue()) {
134 exceptionState.throwTypeError("Currency value required"); 134 exceptionState.throwTypeError("Currency value required");
135 return; 135 return;
136 } 136 }
137 137
138 if (!PaymentsValidators::isValidCurrencyCodeFormat(item.amount().currenc yCode(), &errorMessage)) { 138 if (!PaymentsValidators::isValidCurrencyCodeFormat(item.amount().currenc y(), &errorMessage)) {
Marijn Kruisselbrink 2016/05/16 19:02:48 To really make this match the spec you probably sh
please use gerrit instead 2016/05/16 21:36:36 We would also need to update the validation logic
Marijn Kruisselbrink 2016/05/16 21:43:48 Sure, that works. And to fully match the spec chan
139 exceptionState.throwTypeError(errorMessage); 139 exceptionState.throwTypeError(errorMessage);
140 return; 140 return;
141 } 141 }
142 142
143 if (!PaymentsValidators::isValidAmountFormat(item.amount().value(), &err orMessage)) { 143 if (!PaymentsValidators::isValidAmountFormat(item.amount().value(), &err orMessage)) {
144 exceptionState.throwTypeError(errorMessage); 144 exceptionState.throwTypeError(errorMessage);
145 return; 145 return;
146 } 146 }
147 } 147 }
148 } 148 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void PaymentRequest::clearResolversAndCloseMojoConnection() 433 void PaymentRequest::clearResolversAndCloseMojoConnection()
434 { 434 {
435 m_completeResolver.clear(); 435 m_completeResolver.clear();
436 m_showResolver.clear(); 436 m_showResolver.clear();
437 if (m_clientBinding.is_bound()) 437 if (m_clientBinding.is_bound())
438 m_clientBinding.Close(); 438 m_clientBinding.Close();
439 m_paymentProvider.reset(); 439 m_paymentProvider.reset();
440 } 440 }
441 441
442 } // namespace blink 442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698