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

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

Issue 2054823002: PaymentRequest: complete() method should take PaymentComplete enum value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/JSONValuesForV8.h" 8 #include "bindings/core/v8/JSONValuesForV8.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 const AtomicString& PaymentRequest::interfaceName() const 311 const AtomicString& PaymentRequest::interfaceName() const
312 { 312 {
313 return EventTargetNames::PaymentRequest; 313 return EventTargetNames::PaymentRequest;
314 } 314 }
315 315
316 ExecutionContext* PaymentRequest::getExecutionContext() const 316 ExecutionContext* PaymentRequest::getExecutionContext() const
317 { 317 {
318 return ContextLifecycleObserver::getExecutionContext(); 318 return ContextLifecycleObserver::getExecutionContext();
319 } 319 }
320 320
321 ScriptPromise PaymentRequest::complete(ScriptState* scriptState, bool success) 321 ScriptPromise PaymentRequest::complete(ScriptState* scriptState, PaymentComplete result)
322 { 322 {
323 if (m_completeResolver) 323 if (m_completeResolver)
324 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Already called complete() once")); 324 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Already called complete() once"));
325 325
326 // The payment provider should respond in PaymentRequest::OnComplete(). 326 // The payment provider should respond in PaymentRequest::OnComplete().
327 m_paymentProvider->Complete(success); 327 m_paymentProvider->Complete(mojom::blink::PaymentComplete(result));
328 328
329 m_completeResolver = ScriptPromiseResolver::create(scriptState); 329 m_completeResolver = ScriptPromiseResolver::create(scriptState);
330 return m_completeResolver->promise(); 330 return m_completeResolver->promise();
331 } 331 }
332 332
333 void PaymentRequest::onUpdatePaymentDetails(const ScriptValue& detailsScriptValu e) 333 void PaymentRequest::onUpdatePaymentDetails(const ScriptValue& detailsScriptValu e)
334 { 334 {
335 if (!m_showResolver || !m_paymentProvider) 335 if (!m_showResolver || !m_paymentProvider)
336 return; 336 return;
337 337
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 { 535 {
536 m_completeResolver.clear(); 536 m_completeResolver.clear();
537 m_showResolver.clear(); 537 m_showResolver.clear();
538 m_abortResolver.clear(); 538 m_abortResolver.clear();
539 if (m_clientBinding.is_bound()) 539 if (m_clientBinding.is_bound())
540 m_clientBinding.Close(); 540 m_clientBinding.Close();
541 m_paymentProvider.reset(); 541 m_paymentProvider.reset();
542 } 542 }
543 543
544 } // namespace blink 544 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698