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

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

Issue 2054823002: PaymentRequest: complete() method should take PaymentComplete enum value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: why did I do that? 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/PaymentAddress.h"
9 #include "modules/payments/PaymentCompleter.h" 9 #include "modules/payments/PaymentCompleter.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 27 matching lines...) Expand all
38 38
39 PaymentResponse::~PaymentResponse() 39 PaymentResponse::~PaymentResponse()
40 { 40 {
41 } 41 }
42 42
43 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const 43 ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& e xceptionState) const
44 { 44 {
45 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState)); 45 return ScriptValue(scriptState, fromJSONString(scriptState, m_stringifiedDet ails, exceptionState));
46 } 46 }
47 47
48 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) 48 ScriptPromise PaymentResponse::complete(ScriptState* scriptState, const String& result)
49 { 49 {
50 return m_paymentCompleter->complete(scriptState, success); 50 PaymentComplete convertedResult = Unknown;
51 if (result == "success")
52 convertedResult = Success;
53 if (result == "fail")
54 convertedResult = Fail;
55 return m_paymentCompleter->complete(scriptState, convertedResult);
51 } 56 }
52 57
53 DEFINE_TRACE(PaymentResponse) 58 DEFINE_TRACE(PaymentResponse)
54 { 59 {
55 visitor->trace(m_shippingAddress); 60 visitor->trace(m_shippingAddress);
56 visitor->trace(m_paymentCompleter); 61 visitor->trace(m_paymentCompleter);
57 } 62 }
58 63
59 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698