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

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

Issue 2038333002: PaymentRequest: Provide shippingAddress in PaymentResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698