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

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

Issue 2132973002: Replace a WTF::Function conversion operator to be a function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ScriptPromise PaymentRequest::show(ScriptState* scriptState) 365 ScriptPromise PaymentRequest::show(ScriptState* scriptState)
366 { 366 {
367 if (m_showResolver) 367 if (m_showResolver)
368 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Already called show() once")); 368 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Already called show() once"));
369 369
370 if (!scriptState->domWindow() || !scriptState->domWindow()->frame()) 370 if (!scriptState->domWindow() || !scriptState->domWindow()->frame())
371 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Cannot show the payment request")); 371 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Cannot show the payment request"));
372 372
373 DCHECK(!m_paymentProvider.is_bound()); 373 DCHECK(!m_paymentProvider.is_bound());
374 scriptState->domWindow()->frame()->serviceRegistry()->connectToRemoteService (mojo::GetProxy(&m_paymentProvider)); 374 scriptState->domWindow()->frame()->serviceRegistry()->connectToRemoteService (mojo::GetProxy(&m_paymentProvider));
375 m_paymentProvider.set_connection_error_handler(createBaseCallback(WTF::bind( &PaymentRequest::OnError, wrapWeakPersistent(this)))); 375 m_paymentProvider.set_connection_error_handler(convertToBaseCallback(WTF::bi nd(&PaymentRequest::OnError, wrapWeakPersistent(this))));
376 m_paymentProvider->SetClient(m_clientBinding.CreateInterfacePtrAndBind()); 376 m_paymentProvider->SetClient(m_clientBinding.CreateInterfacePtrAndBind());
377 m_paymentProvider->Show(mojo::WTFArray<mojom::blink::PaymentMethodDataPtr>:: From(m_methodData), mojom::blink::PaymentDetails::From(m_details), mojom::blink: :PaymentOptions::From(m_options)); 377 m_paymentProvider->Show(mojo::WTFArray<mojom::blink::PaymentMethodDataPtr>:: From(m_methodData), mojom::blink::PaymentDetails::From(m_details), mojom::blink: :PaymentOptions::From(m_options));
378 378
379 m_showResolver = ScriptPromiseResolver::create(scriptState); 379 m_showResolver = ScriptPromiseResolver::create(scriptState);
380 return m_showResolver->promise(); 380 return m_showResolver->promise();
381 } 381 }
382 382
383 ScriptPromise PaymentRequest::abort(ScriptState* scriptState) 383 ScriptPromise PaymentRequest::abort(ScriptState* scriptState)
384 { 384 {
385 if (m_abortResolver) 385 if (m_abortResolver)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 { 624 {
625 m_completeResolver.clear(); 625 m_completeResolver.clear();
626 m_showResolver.clear(); 626 m_showResolver.clear();
627 m_abortResolver.clear(); 627 m_abortResolver.clear();
628 if (m_clientBinding.is_bound()) 628 if (m_clientBinding.is_bound())
629 m_clientBinding.Close(); 629 m_clientBinding.Close();
630 m_paymentProvider.reset(); 630 m_paymentProvider.reset();
631 } 631 }
632 632
633 } // namespace blink 633 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698