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/PaymentResponse.h" | 5 #include "modules/payments/PaymentResponse.h" |
6 | 6 |
7 #include "bindings/core/v8/JSONValuesForV8.h" | 7 #include "bindings/core/v8/JSONValuesForV8.h" |
8 #include "modules/payments/PaymentAddress.h" | 8 #include "modules/payments/PaymentAddress.h" |
9 #include "modules/payments/PaymentCompleter.h" | 9 #include "modules/payments/PaymentCompleter.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
11 | 11 |
12 namespace mojo { | |
13 | |
14 template <> | |
15 struct TypeConverter<blink::CurrencyAmount, blink::mojom::blink::CurrencyAmount>
{ | |
16 static blink::CurrencyAmount Convert(const blink::mojom::blink::CurrencyAmou
nt& input) | |
17 { | |
18 blink::CurrencyAmount output; | |
19 output.setCurrency(input.currency); | |
20 output.setValue(input.value); | |
21 return output; | |
22 } | |
23 }; | |
24 | |
25 } // namespace mojo | |
26 | |
27 namespace blink { | 12 namespace blink { |
28 | 13 |
29 PaymentResponse::PaymentResponse(mojom::blink::PaymentResponsePtr response, Paym
entCompleter* paymentCompleter) | 14 PaymentResponse::PaymentResponse(mojom::blink::PaymentResponsePtr response, Paym
entCompleter* paymentCompleter) |
30 : m_methodName(response->method_name) | 15 : m_methodName(response->method_name) |
31 , m_totalAmount(response->total_amount->To<CurrencyAmount>()) | |
32 , m_stringifiedDetails(response->stringified_details) | 16 , m_stringifiedDetails(response->stringified_details) |
33 , m_shippingAddress(response->shipping_address ? new PaymentAddress(std::mov
e(response->shipping_address)) : nullptr) | 17 , m_shippingAddress(response->shipping_address ? new PaymentAddress(std::mov
e(response->shipping_address)) : nullptr) |
34 , m_payerEmail(response->payer_email) | 18 , m_payerEmail(response->payer_email) |
35 , m_payerPhone(response->payer_phone) | 19 , m_payerPhone(response->payer_phone) |
36 , m_paymentCompleter(paymentCompleter) | 20 , m_paymentCompleter(paymentCompleter) |
37 { | 21 { |
38 DCHECK(m_paymentCompleter); | 22 DCHECK(m_paymentCompleter); |
39 } | 23 } |
40 | 24 |
41 PaymentResponse::~PaymentResponse() | 25 PaymentResponse::~PaymentResponse() |
(...skipping 10 matching lines...) Expand all Loading... |
52 return m_paymentCompleter->complete(scriptState, success); | 36 return m_paymentCompleter->complete(scriptState, success); |
53 } | 37 } |
54 | 38 |
55 DEFINE_TRACE(PaymentResponse) | 39 DEFINE_TRACE(PaymentResponse) |
56 { | 40 { |
57 visitor->trace(m_shippingAddress); | 41 visitor->trace(m_shippingAddress); |
58 visitor->trace(m_paymentCompleter); | 42 visitor->trace(m_paymentCompleter); |
59 } | 43 } |
60 | 44 |
61 } // namespace blink | 45 } // namespace blink |
OLD | NEW |