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

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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentResponse.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (!PaymentsValidators::isValidShippingAddress(response->shipping_addre ss, &errorMessage)) { 432 if (!PaymentsValidators::isValidShippingAddress(response->shipping_addre ss, &errorMessage)) {
433 m_showResolver->reject(DOMException::create(SyntaxError, errorMessag e)); 433 m_showResolver->reject(DOMException::create(SyntaxError, errorMessag e));
434 clearResolversAndCloseMojoConnection(); 434 clearResolversAndCloseMojoConnection();
435 return; 435 return;
436 } 436 }
437 437
438 m_shippingAddress = new PaymentAddress(std::move(response->shipping_addr ess)); 438 m_shippingAddress = new PaymentAddress(std::move(response->shipping_addr ess));
439 m_shippingOption = response->shipping_option_id; 439 m_shippingOption = response->shipping_option_id;
440 } 440 }
441 441
442 if (response->payer_email) {
443 m_payerEmail = response->payer_email;
zino 2016/06/06 07:26:50 This should happen if requestPayerEmail is true.
444 }
445
446 if (response->payer_phone) {
447 m_payerPhone = response->payer_phone;
zino 2016/06/06 07:26:50 ditto
448 }
449
442 m_showResolver->resolve(new PaymentResponse(std::move(response), this)); 450 m_showResolver->resolve(new PaymentResponse(std::move(response), this));
443 451
444 // Do not close the mojo connection here. The merchant website should call 452 // Do not close the mojo connection here. The merchant website should call
445 // PaymentResponse::complete(boolean), which will be forwarded over the mojo 453 // PaymentResponse::complete(boolean), which will be forwarded over the mojo
446 // connection to display a success or failure message to the user. 454 // connection to display a success or failure message to the user.
447 m_showResolver.clear(); 455 m_showResolver.clear();
448 } 456 }
449 457
450 void PaymentRequest::OnError() 458 void PaymentRequest::OnError()
451 { 459 {
(...skipping 14 matching lines...) Expand all
466 void PaymentRequest::clearResolversAndCloseMojoConnection() 474 void PaymentRequest::clearResolversAndCloseMojoConnection()
467 { 475 {
468 m_completeResolver.clear(); 476 m_completeResolver.clear();
469 m_showResolver.clear(); 477 m_showResolver.clear();
470 if (m_clientBinding.is_bound()) 478 if (m_clientBinding.is_bound())
471 m_clientBinding.Close(); 479 m_clientBinding.Close();
472 m_paymentProvider.reset(); 480 m_paymentProvider.reset();
473 } 481 }
474 482
475 } // namespace blink 483 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentResponse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698