| Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| index 0adcb7c08c18fef7a5854aad5bb668a64e8c21d6..4d453547a2c7e48ec6abf6e41700a1f88176814a 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| @@ -361,6 +361,20 @@ String getSelectedShippingOption(const PaymentDetails& details)
|
| return result;
|
| }
|
|
|
| +String getValidShippingType(const String& shippingType)
|
| +{
|
| + static const char* const validValues[] = {
|
| + "shipping",
|
| + "delivery",
|
| + "pickup",
|
| + };
|
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(validValues); i++) {
|
| + if (shippingType == validValues[i])
|
| + return shippingType;
|
| + }
|
| + return validValues[0];
|
| +}
|
| +
|
| } // namespace
|
|
|
| PaymentRequest* PaymentRequest::create(ScriptState* scriptState, const HeapVector<PaymentMethodData>& methodData, const PaymentDetails& details, ExceptionState& exceptionState)
|
| @@ -519,8 +533,10 @@ PaymentRequest::PaymentRequest(ScriptState* scriptState, const HeapVector<Paymen
|
| if (exceptionState.hadException())
|
| return;
|
|
|
| - if (m_options.requestShipping())
|
| + if (m_options.requestShipping()) {
|
| m_shippingOption = getSelectedShippingOption(details);
|
| + m_shippingType = getValidShippingType(m_options.shippingType());
|
| + }
|
|
|
| scriptState->domWindow()->frame()->interfaceProvider()->getInterface(mojo::GetProxy(&m_paymentProvider));
|
| m_paymentProvider.set_connection_error_handler(convertToBaseCallback(WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), mojom::blink::PaymentErrorReason::UNKNOWN)));
|
|
|