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(nullptr) | |
please use gerrit instead
2016/06/06 01:09:34
, m_shippingAddress(response->shipping_address ? n
zino
2016/06/06 10:02:13
Done.
| |
16 , m_paymentCompleter(paymentCompleter) | 18 , m_paymentCompleter(paymentCompleter) |
17 { | 19 { |
18 DCHECK(m_paymentCompleter); | 20 DCHECK(m_paymentCompleter); |
21 if (response && response->shipping_address) | |
please use gerrit instead
2016/06/06 01:09:34
remove this block
zino
2016/06/06 10:02:13
Done.
| |
22 m_shippingAddress = new PaymentAddress(std::move(response->shipping_addr ess)); | |
19 } | 23 } |
20 | 24 |
21 PaymentResponse::~PaymentResponse() | 25 PaymentResponse::~PaymentResponse() |
22 { | 26 { |
23 } | 27 } |
24 | 28 |
25 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const | 29 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const |
26 { | 30 { |
27 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState)); | 31 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState)); |
28 } | 32 } |
29 | 33 |
30 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) | 34 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) |
31 { | 35 { |
32 return m_paymentCompleter->complete(scriptState, success); | 36 return m_paymentCompleter->complete(scriptState, success); |
33 } | 37 } |
34 | 38 |
35 DEFINE_TRACE(PaymentResponse) | 39 DEFINE_TRACE(PaymentResponse) |
36 { | 40 { |
41 visitor->trace(m_shippingAddress); | |
37 visitor->trace(m_paymentCompleter); | 42 visitor->trace(m_paymentCompleter); |
38 } | 43 } |
39 | 44 |
40 } // namespace blink | 45 } // namespace blink |
OLD | NEW |