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

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

Issue 2038423002: Adding support for phone and email. (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/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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 m_shippingAddress = new PaymentAddress(response->shipping_address.Clone( )); 444 m_shippingAddress = new PaymentAddress(response->shipping_address.Clone( ));
445 m_shippingOption = response->shipping_option_id; 445 m_shippingOption = response->shipping_option_id;
446 } else { 446 } else {
447 if (response->shipping_address) { 447 if (response->shipping_address) {
448 m_showResolver->reject(DOMException::create(SyntaxError)); 448 m_showResolver->reject(DOMException::create(SyntaxError));
449 clearResolversAndCloseMojoConnection(); 449 clearResolversAndCloseMojoConnection();
450 return; 450 return;
451 } 451 }
452 } 452 }
453 453
454 if (m_options.requestPayerEmail() && !response->payer_email.isNull()) {
zino 2016/06/06 14:19:32 I think it should be "if (m_options.requestPayerEm
zino 2016/06/06 14:19:32 I'm not sure but the promise may have to reject if
please use gerrit instead 2016/06/06 15:43:42 The spec is not very clear on this topic. However,
455 m_payerEmail = response->payer_email;
please use gerrit instead 2016/06/06 15:43:42 There's no need to save email an phone as member v
456 }
457
458 if (m_options.requestPayerPhone() && !response->payer_phone.isNull()) {
zino 2016/06/06 14:19:32 ditto
459 m_payerPhone = response->payer_phone;
460 }
461
454 m_showResolver->resolve(new PaymentResponse(std::move(response), this)); 462 m_showResolver->resolve(new PaymentResponse(std::move(response), this));
455 463
456 // Do not close the mojo connection here. The merchant website should call 464 // Do not close the mojo connection here. The merchant website should call
457 // PaymentResponse::complete(boolean), which will be forwarded over the mojo 465 // PaymentResponse::complete(boolean), which will be forwarded over the mojo
458 // connection to display a success or failure message to the user. 466 // connection to display a success or failure message to the user.
459 m_showResolver.clear(); 467 m_showResolver.clear();
460 } 468 }
461 469
462 void PaymentRequest::OnError() 470 void PaymentRequest::OnError()
463 { 471 {
(...skipping 14 matching lines...) Expand all
478 void PaymentRequest::clearResolversAndCloseMojoConnection() 486 void PaymentRequest::clearResolversAndCloseMojoConnection()
479 { 487 {
480 m_completeResolver.clear(); 488 m_completeResolver.clear();
481 m_showResolver.clear(); 489 m_showResolver.clear();
482 if (m_clientBinding.is_bound()) 490 if (m_clientBinding.is_bound())
483 m_clientBinding.Close(); 491 m_clientBinding.Close();
484 m_paymentProvider.reset(); 492 m_paymentProvider.reset();
485 } 493 }
486 494
487 } // namespace blink 495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698