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

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

Issue 1753543002: PaymentRequest Mojo bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: haraken@'s + esprehn@'s comments Created 4 years, 8 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 "bindings/core/v8/ScriptState.h" 8 #include "modules/payments/PaymentCompleter.h"
9 #include "core/dom/DOMException.h" 9 #include "wtf/Assertions.h"
10 #include "core/dom/ExceptionCode.h"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 PaymentResponse::PaymentResponse() 13 PaymentResponse::PaymentResponse(mojom::wtf::PaymentResponsePtr response, Paymen tCompleter* paymentCompleter)
14 : m_methodName(response->method_name)
15 , m_stringifiedDetails(response->stringified_details)
16 , m_paymentCompleter(paymentCompleter)
15 { 17 {
18 DCHECK(m_paymentCompleter);
16 } 19 }
17 20
18 PaymentResponse::~PaymentResponse() 21 PaymentResponse::~PaymentResponse()
19 { 22 {
20 } 23 }
21 24
22 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const 25 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const
23 { 26 {
24 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState)); 27 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState));
25 } 28 }
26 29
27 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) 30 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success)
28 { 31 {
29 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError, "Not implemented.")); 32 return m_paymentCompleter->complete(scriptState, success);
33 }
34
35 DEFINE_TRACE(PaymentResponse)
36 {
37 visitor->trace(m_paymentCompleter);
30 } 38 }
31 39
32 } // namespace blink 40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698