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/ConditionalFeatures.h" | 7 #include "bindings/core/v8/ConditionalFeatures.h" |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 return false; | 591 return false; |
592 } | 592 } |
593 | 593 |
594 // If Feature Policy is enabled. then we need this hack to support it, until | 594 // If Feature Policy is enabled. then we need this hack to support it, until |
595 // we have proper support for <iframe allowfullscreen> in FP: | 595 // we have proper support for <iframe allowfullscreen> in FP: |
596 // TODO(lunalu): clean up the code once FP iframe is supported | 596 // TODO(lunalu): clean up the code once FP iframe is supported |
597 // crbug.com/682280 | 597 // crbug.com/682280 |
598 | 598 |
599 // 1. If FP, by itself, enables paymentrequest in this document, then | 599 // 1. If FP, by itself, enables paymentrequest in this document, then |
600 // paymentrequest is allowed. | 600 // paymentrequest is allowed. |
601 if (frame->securityContext()->getFeaturePolicy()->isFeatureEnabled( | 601 if (isFeatureEnabledInFrame(WebFeaturePolicyFeature::Payment, frame)) { |
602 kPaymentFeature)) { | |
603 return true; | 602 return true; |
604 } | 603 } |
605 | 604 |
606 // 2. Otherwise, if the embedding frame's document is allowed to use | 605 // 2. Otherwise, if the embedding frame's document is allowed to use |
607 // paymentrequest (either through FP or otherwise), and either: | 606 // paymentrequest (either through FP or otherwise), and either: |
608 // a) this is a same-origin embedded document, or | 607 // a) this is a same-origin embedded document, or |
609 // b) this document's iframe has the allowpayment attribute set, | 608 // b) this document's iframe has the allowpayment attribute set, |
610 // then paymentrequest is allowed. | 609 // then paymentrequest is allowed. |
611 if (!frame->isMainFrame()) { | 610 if (!frame->isMainFrame()) { |
612 if (allowedToUsePaymentRequest(frame->tree().parent())) { | 611 if (allowedToUsePaymentRequest(frame->tree().parent())) { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 m_completeResolver.clear(); | 1045 m_completeResolver.clear(); |
1047 m_showResolver.clear(); | 1046 m_showResolver.clear(); |
1048 m_abortResolver.clear(); | 1047 m_abortResolver.clear(); |
1049 m_canMakePaymentResolver.clear(); | 1048 m_canMakePaymentResolver.clear(); |
1050 if (m_clientBinding.is_bound()) | 1049 if (m_clientBinding.is_bound()) |
1051 m_clientBinding.Close(); | 1050 m_clientBinding.Close(); |
1052 m_paymentProvider.reset(); | 1051 m_paymentProvider.reset(); |
1053 } | 1052 } |
1054 | 1053 |
1055 } // namespace blink | 1054 } // namespace blink |
OLD | NEW |