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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 #include "bindings/core/v8/ConditionalFeaturesForCore.h" | |
10 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
11 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
12 #include "bindings/core/v8/ScriptState.h" | 11 #include "bindings/core/v8/ScriptState.h" |
13 #include "bindings/core/v8/V8StringResource.h" | 12 #include "bindings/core/v8/V8StringResource.h" |
14 #include "bindings/modules/v8/V8AndroidPayMethodData.h" | 13 #include "bindings/modules/v8/V8AndroidPayMethodData.h" |
15 #include "bindings/modules/v8/V8BasicCardRequest.h" | 14 #include "bindings/modules/v8/V8BasicCardRequest.h" |
16 #include "bindings/modules/v8/V8PaymentDetails.h" | 15 #include "bindings/modules/v8/V8PaymentDetails.h" |
17 #include "core/EventTypeNames.h" | 16 #include "core/EventTypeNames.h" |
18 #include "core/dom/DOMException.h" | 17 #include "core/dom/DOMException.h" |
19 #include "core/dom/Document.h" | 18 #include "core/dom/Document.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 return false; | 590 return false; |
592 } | 591 } |
593 | 592 |
594 // If Feature Policy is enabled. then we need this hack to support it, until | 593 // If Feature Policy is enabled. then we need this hack to support it, until |
595 // we have proper support for <iframe allowfullscreen> in FP: | 594 // we have proper support for <iframe allowfullscreen> in FP: |
596 // TODO(lunalu): clean up the code once FP iframe is supported | 595 // TODO(lunalu): clean up the code once FP iframe is supported |
597 // crbug.com/682280 | 596 // crbug.com/682280 |
598 | 597 |
599 // 1. If FP, by itself, enables paymentrequest in this document, then | 598 // 1. If FP, by itself, enables paymentrequest in this document, then |
600 // paymentrequest is allowed. | 599 // paymentrequest is allowed. |
601 if (isFeatureEnabledInFrame(WebFeaturePolicyFeature::Payment, frame)) { | 600 if (frame->isFeatureEnabled(WebFeaturePolicyFeature::Payment)) { |
602 return true; | 601 return true; |
603 } | 602 } |
604 | 603 |
605 // 2. Otherwise, if the embedding frame's document is allowed to use | 604 // 2. Otherwise, if the embedding frame's document is allowed to use |
606 // paymentrequest (either through FP or otherwise), and either: | 605 // paymentrequest (either through FP or otherwise), and either: |
607 // a) this is a same-origin embedded document, or | 606 // a) this is a same-origin embedded document, or |
608 // b) this document's iframe has the allowpayment attribute set, | 607 // b) this document's iframe has the allowpayment attribute set, |
609 // then paymentrequest is allowed. | 608 // then paymentrequest is allowed. |
610 if (!frame->isMainFrame()) { | 609 if (!frame->isMainFrame()) { |
611 if (allowedToUsePaymentRequest(frame->tree().parent())) { | 610 if (allowedToUsePaymentRequest(frame->tree().parent())) { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 m_completeResolver.clear(); | 1062 m_completeResolver.clear(); |
1064 m_showResolver.clear(); | 1063 m_showResolver.clear(); |
1065 m_abortResolver.clear(); | 1064 m_abortResolver.clear(); |
1066 m_canMakePaymentResolver.clear(); | 1065 m_canMakePaymentResolver.clear(); |
1067 if (m_clientBinding.is_bound()) | 1066 if (m_clientBinding.is_bound()) |
1068 m_clientBinding.Close(); | 1067 m_clientBinding.Close(); |
1069 m_paymentProvider.reset(); | 1068 m_paymentProvider.reset(); |
1070 } | 1069 } |
1071 | 1070 |
1072 } // namespace blink | 1071 } // namespace blink |
OLD | NEW |