| 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 "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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 using blink::mojom::blink::PaymentDetailsPtr; | 42 using blink::mojom::blink::PaymentDetailsPtr; |
| 43 using blink::mojom::blink::PaymentErrorReason; | 43 using blink::mojom::blink::PaymentErrorReason; |
| 44 using blink::mojom::blink::PaymentItem; | 44 using blink::mojom::blink::PaymentItem; |
| 45 using blink::mojom::blink::PaymentItemPtr; | 45 using blink::mojom::blink::PaymentItemPtr; |
| 46 using blink::mojom::blink::PaymentMethodData; | 46 using blink::mojom::blink::PaymentMethodData; |
| 47 using blink::mojom::blink::PaymentMethodDataPtr; | 47 using blink::mojom::blink::PaymentMethodDataPtr; |
| 48 using blink::mojom::blink::PaymentOptions; | 48 using blink::mojom::blink::PaymentOptions; |
| 49 using blink::mojom::blink::PaymentOptionsPtr; | 49 using blink::mojom::blink::PaymentOptionsPtr; |
| 50 using blink::mojom::blink::PaymentShippingOption; | 50 using blink::mojom::blink::PaymentShippingOption; |
| 51 using blink::mojom::blink::PaymentShippingOptionPtr; | 51 using blink::mojom::blink::PaymentShippingOptionPtr; |
| 52 using blink::mojom::blink::PaymentShippingType; |
| 52 | 53 |
| 53 template <> | 54 template <> |
| 54 struct TypeConverter<PaymentCurrencyAmountPtr, blink::PaymentCurrencyAmount> { | 55 struct TypeConverter<PaymentCurrencyAmountPtr, blink::PaymentCurrencyAmount> { |
| 55 static PaymentCurrencyAmountPtr Convert( | 56 static PaymentCurrencyAmountPtr Convert( |
| 56 const blink::PaymentCurrencyAmount& input) { | 57 const blink::PaymentCurrencyAmount& input) { |
| 57 PaymentCurrencyAmountPtr output = PaymentCurrencyAmount::New(); | 58 PaymentCurrencyAmountPtr output = PaymentCurrencyAmount::New(); |
| 58 output->currency = input.currency(); | 59 output->currency = input.currency(); |
| 59 output->value = input.value(); | 60 output->value = input.value(); |
| 60 return output; | 61 return output; |
| 61 } | 62 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 template <> | 147 template <> |
| 147 struct TypeConverter<PaymentOptionsPtr, blink::PaymentOptions> { | 148 struct TypeConverter<PaymentOptionsPtr, blink::PaymentOptions> { |
| 148 static PaymentOptionsPtr Convert(const blink::PaymentOptions& input) { | 149 static PaymentOptionsPtr Convert(const blink::PaymentOptions& input) { |
| 149 PaymentOptionsPtr output = PaymentOptions::New(); | 150 PaymentOptionsPtr output = PaymentOptions::New(); |
| 150 output->request_payer_name = input.requestPayerName(); | 151 output->request_payer_name = input.requestPayerName(); |
| 151 output->request_payer_email = input.requestPayerEmail(); | 152 output->request_payer_email = input.requestPayerEmail(); |
| 152 output->request_payer_phone = input.requestPayerPhone(); | 153 output->request_payer_phone = input.requestPayerPhone(); |
| 153 output->request_shipping = input.requestShipping(); | 154 output->request_shipping = input.requestShipping(); |
| 155 |
| 156 if (input.shippingType() == "delivery") |
| 157 output->shipping_type = PaymentShippingType::DELIVERY; |
| 158 else if (input.shippingType() == "pickup") |
| 159 output->shipping_type = PaymentShippingType::PICKUP; |
| 160 else |
| 161 output->shipping_type = PaymentShippingType::SHIPPING; |
| 162 |
| 154 return output; | 163 return output; |
| 155 } | 164 } |
| 156 }; | 165 }; |
| 157 | 166 |
| 158 template <> | 167 template <> |
| 159 struct TypeConverter<WTFArray<PaymentMethodDataPtr>, | 168 struct TypeConverter<WTFArray<PaymentMethodDataPtr>, |
| 160 WTF::Vector<blink::PaymentRequest::MethodData>> { | 169 WTF::Vector<blink::PaymentRequest::MethodData>> { |
| 161 static WTFArray<PaymentMethodDataPtr> Convert( | 170 static WTFArray<PaymentMethodDataPtr> Convert( |
| 162 const WTF::Vector<blink::PaymentRequest::MethodData>& input) { | 171 const WTF::Vector<blink::PaymentRequest::MethodData>& input) { |
| 163 WTFArray<PaymentMethodDataPtr> output(input.size()); | 172 WTFArray<PaymentMethodDataPtr> output(input.size()); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 m_completeTimer.stop(); | 844 m_completeTimer.stop(); |
| 836 m_completeResolver.clear(); | 845 m_completeResolver.clear(); |
| 837 m_showResolver.clear(); | 846 m_showResolver.clear(); |
| 838 m_abortResolver.clear(); | 847 m_abortResolver.clear(); |
| 839 if (m_clientBinding.is_bound()) | 848 if (m_clientBinding.is_bound()) |
| 840 m_clientBinding.Close(); | 849 m_clientBinding.Close(); |
| 841 m_paymentProvider.reset(); | 850 m_paymentProvider.reset(); |
| 842 } | 851 } |
| 843 | 852 |
| 844 } // namespace blink | 853 } // namespace blink |
| OLD | NEW |