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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Duplicate FP object rather than modifying in-place Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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/ConditionalFeatures.h" 9 #include "bindings/core/v8/ConditionalFeaturesForCore.h"
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/ScriptPromiseResolver.h" 11 #include "bindings/core/v8/ScriptPromiseResolver.h"
12 #include "bindings/core/v8/ScriptState.h" 12 #include "bindings/core/v8/ScriptState.h"
13 #include "bindings/core/v8/V8StringResource.h" 13 #include "bindings/core/v8/V8StringResource.h"
14 #include "bindings/modules/v8/V8AndroidPayMethodData.h" 14 #include "bindings/modules/v8/V8AndroidPayMethodData.h"
15 #include "bindings/modules/v8/V8BasicCardRequest.h" 15 #include "bindings/modules/v8/V8BasicCardRequest.h"
16 #include "bindings/modules/v8/V8PaymentDetails.h" 16 #include "bindings/modules/v8/V8PaymentDetails.h"
17 #include "core/EventTypeNames.h" 17 #include "core/EventTypeNames.h"
18 #include "core/dom/DOMException.h" 18 #include "core/dom/DOMException.h"
19 #include "core/dom/Document.h" 19 #include "core/dom/Document.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 m_completeResolver.clear(); 1063 m_completeResolver.clear();
1065 m_showResolver.clear(); 1064 m_showResolver.clear();
1066 m_abortResolver.clear(); 1065 m_abortResolver.clear();
1067 m_canMakePaymentResolver.clear(); 1066 m_canMakePaymentResolver.clear();
1068 if (m_clientBinding.is_bound()) 1067 if (m_clientBinding.is_bound())
1069 m_clientBinding.Close(); 1068 m_clientBinding.Close();
1070 m_paymentProvider.reset(); 1069 m_paymentProvider.reset();
1071 } 1070 }
1072 1071
1073 } // namespace blink 1072 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698