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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2767983003: Initial Implementation of Iframe Attribute for Feature Policy (Part 4) (Closed)
Patch Set: Codereview: nit + added more unit tests for container policy Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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 6283adc3f709a6c6d072ed626691c1c49a77e20a..1c2bbb0bc5a2292103b88b9795f95558de34174c 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -638,37 +638,8 @@ bool AllowedToUsePaymentRequest(const Frame* frame) {
return false;
}
- // If Feature Policy is enabled. then we need this hack to support it, until
- // we have proper support for <iframe allowfullscreen> in FP:
- // TODO(lunalu): clean up the code once FP iframe is supported
- // crbug.com/682280
-
- // 1. If FP, by itself, enables paymentrequest in this document, then
- // paymentrequest is allowed.
- if (frame->IsFeatureEnabled(WebFeaturePolicyFeature::kPayment)) {
- return true;
- }
-
- // 2. Otherwise, if the embedding frame's document is allowed to use
- // paymentrequest (either through FP or otherwise), and either:
- // a) this is a same-origin embedded document, or
- // b) this document's iframe has the allowpayment attribute set,
- // then paymentrequest is allowed.
- if (!frame->IsMainFrame()) {
- if (AllowedToUsePaymentRequest(frame->Tree().Parent())) {
- return (frame->Owner() && frame->Owner()->AllowPaymentRequest()) ||
- frame->Tree()
- .Parent()
- ->GetSecurityContext()
- ->GetSecurityOrigin()
- ->IsSameSchemeHostPortAndSuborigin(
- frame->GetSecurityContext()->GetSecurityOrigin());
- }
- }
-
- // Otherwise, paymentrequest is not allowed. (If we reach here and this is
- // the main frame, then paymentrequest must have been disabled by FP.)
- return false;
+ // 2. If Feature Policy is enabled, return the policy for "payment" feature.
+ return frame->IsFeatureEnabled(WebFeaturePolicyFeature::kPayment);
}
void WarnIgnoringQueryQuotaForCanMakePayment(

Powered by Google App Engine
This is Rietveld 408576698