Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |