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/PaymentCompleter.h" | 9 #include "modules/payments/PaymentCompleter.h" |
9 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 PaymentResponse::PaymentResponse(mojom::blink::PaymentResponsePtr response, Paym
entCompleter* paymentCompleter) | 14 PaymentResponse::PaymentResponse(mojom::blink::PaymentResponsePtr response, Paym
entCompleter* paymentCompleter) |
14 : m_methodName(response->method_name) | 15 : m_methodName(response->method_name) |
15 , m_stringifiedDetails(response->stringified_details) | 16 , m_stringifiedDetails(response->stringified_details) |
| 17 , m_shippingAddress(response->shipping_address ? new PaymentAddress(std::mov
e(response->shipping_address)) : nullptr) |
16 , m_paymentCompleter(paymentCompleter) | 18 , m_paymentCompleter(paymentCompleter) |
17 { | 19 { |
18 DCHECK(m_paymentCompleter); | 20 DCHECK(m_paymentCompleter); |
19 } | 21 } |
20 | 22 |
21 PaymentResponse::~PaymentResponse() | 23 PaymentResponse::~PaymentResponse() |
22 { | 24 { |
23 } | 25 } |
24 | 26 |
25 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const | 27 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e
xceptionState) const |
26 { | 28 { |
27 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); | 29 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet
ails, exceptionState)); |
28 } | 30 } |
29 | 31 |
30 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) | 32 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) |
31 { | 33 { |
32 return m_paymentCompleter->complete(scriptState, success); | 34 return m_paymentCompleter->complete(scriptState, success); |
33 } | 35 } |
34 | 36 |
35 DEFINE_TRACE(PaymentResponse) | 37 DEFINE_TRACE(PaymentResponse) |
36 { | 38 { |
| 39 visitor->trace(m_shippingAddress); |
37 visitor->trace(m_paymentCompleter); | 40 visitor->trace(m_paymentCompleter); |
38 } | 41 } |
39 | 42 |
40 } // namespace blink | 43 } // namespace blink |
OLD | NEW |