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

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

Issue 2348103002: PaymentRequest: Add support for payerName. (in blink side) (Closed)
Patch Set: PaymentRequest: Add support for payerName. (in blink side) Created 4 years, 3 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 return output; 128 return output;
129 } 129 }
130 }; 130 };
131 131
132 template <> 132 template <>
133 struct TypeConverter<PaymentOptionsPtr, blink::PaymentOptions> { 133 struct TypeConverter<PaymentOptionsPtr, blink::PaymentOptions> {
134 static PaymentOptionsPtr Convert(const blink::PaymentOptions& input) 134 static PaymentOptionsPtr Convert(const blink::PaymentOptions& input)
135 { 135 {
136 PaymentOptionsPtr output = PaymentOptions::New(); 136 PaymentOptionsPtr output = PaymentOptions::New();
137 output->request_payer_name = input.requestPayerName();
137 output->request_payer_email = input.requestPayerEmail(); 138 output->request_payer_email = input.requestPayerEmail();
138 output->request_payer_phone = input.requestPayerPhone(); 139 output->request_payer_phone = input.requestPayerPhone();
139 output->request_shipping = input.requestShipping(); 140 output->request_shipping = input.requestShipping();
140 return output; 141 return output;
141 } 142 }
142 }; 143 };
143 144
144 template <> 145 template <>
145 struct TypeConverter<WTFArray<PaymentMethodDataPtr>, WTF::Vector<blink::PaymentR equest::MethodData>> { 146 struct TypeConverter<WTFArray<PaymentMethodDataPtr>, WTF::Vector<blink::PaymentR equest::MethodData>> {
146 static WTFArray<PaymentMethodDataPtr> Convert(const WTF::Vector<blink::Payme ntRequest::MethodData>& input) 147 static WTFArray<PaymentMethodDataPtr> Convert(const WTF::Vector<blink::Payme ntRequest::MethodData>& input)
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 m_shippingAddress = new PaymentAddress(response->shipping_address.Clone( )); 606 m_shippingAddress = new PaymentAddress(response->shipping_address.Clone( ));
606 m_shippingOption = response->shipping_option; 607 m_shippingOption = response->shipping_option;
607 } else { 608 } else {
608 if (response->shipping_address || !response->shipping_option.isNull()) { 609 if (response->shipping_address || !response->shipping_option.isNull()) {
609 m_showResolver->reject(DOMException::create(SyntaxError)); 610 m_showResolver->reject(DOMException::create(SyntaxError));
610 clearResolversAndCloseMojoConnection(); 611 clearResolversAndCloseMojoConnection();
611 return; 612 return;
612 } 613 }
613 } 614 }
614 615
615 if ((m_options.requestPayerEmail() && response->payer_email.isEmpty()) 616 if ((m_options.requestPayerName() && response->payer_name.isEmpty())
foolip 2016/09/19 15:34:40 Off-topic: does this API not allow for a way to re
617 || (m_options.requestPayerEmail() && response->payer_email.isEmpty())
616 || (m_options.requestPayerPhone() && response->payer_phone.isEmpty()) 618 || (m_options.requestPayerPhone() && response->payer_phone.isEmpty())
619 || (!m_options.requestPayerName() && !response->payer_name.isNull())
617 || (!m_options.requestPayerEmail() && !response->payer_email.isNull()) 620 || (!m_options.requestPayerEmail() && !response->payer_email.isNull())
618 || (!m_options.requestPayerPhone() && !response->payer_phone.isNull())) { 621 || (!m_options.requestPayerPhone() && !response->payer_phone.isNull())) {
619 m_showResolver->reject(DOMException::create(SyntaxError)); 622 m_showResolver->reject(DOMException::create(SyntaxError));
620 clearResolversAndCloseMojoConnection(); 623 clearResolversAndCloseMojoConnection();
621 return; 624 return;
622 } 625 }
623 626
624 m_completeTimer.startOneShot(completeTimeoutSeconds, BLINK_FROM_HERE); 627 m_completeTimer.startOneShot(completeTimeoutSeconds, BLINK_FROM_HERE);
625 628
626 m_showResolver->resolve(new PaymentResponse(std::move(response), this)); 629 m_showResolver->resolve(new PaymentResponse(std::move(response), this));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 m_completeTimer.stop(); 715 m_completeTimer.stop();
713 m_completeResolver.clear(); 716 m_completeResolver.clear();
714 m_showResolver.clear(); 717 m_showResolver.clear();
715 m_abortResolver.clear(); 718 m_abortResolver.clear();
716 if (m_clientBinding.is_bound()) 719 if (m_clientBinding.is_bound())
717 m_clientBinding.Close(); 720 m_clientBinding.Close();
718 m_paymentProvider.reset(); 721 m_paymentProvider.reset();
719 } 722 }
720 723
721 } // namespace blink 724 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698