| 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/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8StringResource.h" | 10 #include "bindings/core/v8/V8StringResource.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "modules/payments/AndroidPayTokenization.h" | 22 #include "modules/payments/AndroidPayTokenization.h" |
| 23 #include "modules/payments/HTMLIFrameElementPayments.h" | 23 #include "modules/payments/HTMLIFrameElementPayments.h" |
| 24 #include "modules/payments/PaymentAddress.h" | 24 #include "modules/payments/PaymentAddress.h" |
| 25 #include "modules/payments/PaymentItem.h" | 25 #include "modules/payments/PaymentItem.h" |
| 26 #include "modules/payments/PaymentRequestUpdateEvent.h" | 26 #include "modules/payments/PaymentRequestUpdateEvent.h" |
| 27 #include "modules/payments/PaymentResponse.h" | 27 #include "modules/payments/PaymentResponse.h" |
| 28 #include "modules/payments/PaymentShippingOption.h" | 28 #include "modules/payments/PaymentShippingOption.h" |
| 29 #include "modules/payments/PaymentsValidators.h" | 29 #include "modules/payments/PaymentsValidators.h" |
| 30 #include "mojo/public/cpp/bindings/interface_request.h" | 30 #include "mojo/public/cpp/bindings/interface_request.h" |
| 31 #include "mojo/public/cpp/bindings/wtf_array.h" | 31 #include "mojo/public/cpp/bindings/wtf_array.h" |
| 32 #include "platform/RuntimeEnabledFeatures.h" |
| 32 #include "platform/mojo/MojoHelper.h" | 33 #include "platform/mojo/MojoHelper.h" |
| 33 #include "public/platform/InterfaceProvider.h" | 34 #include "public/platform/InterfaceProvider.h" |
| 34 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
| 35 #include "public/platform/WebTraceLocation.h" | 36 #include "public/platform/WebTraceLocation.h" |
| 36 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
| 37 #include <utility> | 38 #include <utility> |
| 38 | 39 |
| 39 using payments::mojom::blink::ActivePaymentQueryResult; | 40 using payments::mojom::blink::ActivePaymentQueryResult; |
| 40 using payments::mojom::blink::PaymentAddressPtr; | 41 using payments::mojom::blink::PaymentAddressPtr; |
| 41 using payments::mojom::blink::PaymentCurrencyAmount; | 42 using payments::mojom::blink::PaymentCurrencyAmount; |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 if (exceptionState.hadException()) | 726 if (exceptionState.hadException()) |
| 726 return; | 727 return; |
| 727 | 728 |
| 728 if (!scriptState->getExecutionContext()->isSecureContext()) { | 729 if (!scriptState->getExecutionContext()->isSecureContext()) { |
| 729 exceptionState.throwSecurityError("Must be in a secure context"); | 730 exceptionState.throwSecurityError("Must be in a secure context"); |
| 730 return; | 731 return; |
| 731 } | 732 } |
| 732 | 733 |
| 733 if (!allowedToUsePaymentRequest(scriptState->domWindow()->frame())) { | 734 if (!allowedToUsePaymentRequest(scriptState->domWindow()->frame())) { |
| 734 exceptionState.throwSecurityError( | 735 exceptionState.throwSecurityError( |
| 735 "Must be in a top-level browsing context or an iframe needs to specify " | 736 RuntimeEnabledFeatures::paymentRequestIFrameEnabled() |
| 736 "'allowpaymentrequest' explicitly"); | 737 ? "Must be in a top-level browsing context or an iframe needs to " |
| 738 "specify 'allowpaymentrequest' explicitly" |
| 739 : "Must be in a top-level browsing context"); |
| 737 return; | 740 return; |
| 738 } | 741 } |
| 739 | 742 |
| 740 bool keepShippingOptions = validatePaymentDetails(details, exceptionState); | 743 bool keepShippingOptions = validatePaymentDetails(details, exceptionState); |
| 741 if (exceptionState.hadException()) | 744 if (exceptionState.hadException()) |
| 742 return; | 745 return; |
| 743 | 746 |
| 744 if (details.hasError() && !details.error().isEmpty()) { | 747 if (details.hasError() && !details.error().isEmpty()) { |
| 745 exceptionState.throwTypeError("Error value should be empty"); | 748 exceptionState.throwTypeError("Error value should be empty"); |
| 746 return; | 749 return; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 m_completeResolver.clear(); | 966 m_completeResolver.clear(); |
| 964 m_showResolver.clear(); | 967 m_showResolver.clear(); |
| 965 m_abortResolver.clear(); | 968 m_abortResolver.clear(); |
| 966 m_canMakeActivePaymentResolver.clear(); | 969 m_canMakeActivePaymentResolver.clear(); |
| 967 if (m_clientBinding.is_bound()) | 970 if (m_clientBinding.is_bound()) |
| 968 m_clientBinding.Close(); | 971 m_clientBinding.Close(); |
| 969 m_paymentProvider.reset(); | 972 m_paymentProvider.reset(); |
| 970 } | 973 } |
| 971 | 974 |
| 972 } // namespace blink | 975 } // namespace blink |
| OLD | NEW |