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

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

Issue 2873433002: Enable Feature Policy without experimental features or fullscreen (Closed)
Patch Set: Codereview: pass enum instead of string to IsSupportedInFeaturePolicy Created 3 years, 7 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/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 22 matching lines...) Expand all
33 #include "modules/payments/PaymentDetailsUpdate.h" 33 #include "modules/payments/PaymentDetailsUpdate.h"
34 #include "modules/payments/PaymentItem.h" 34 #include "modules/payments/PaymentItem.h"
35 #include "modules/payments/PaymentRequestUpdateEvent.h" 35 #include "modules/payments/PaymentRequestUpdateEvent.h"
36 #include "modules/payments/PaymentResponse.h" 36 #include "modules/payments/PaymentResponse.h"
37 #include "modules/payments/PaymentShippingOption.h" 37 #include "modules/payments/PaymentShippingOption.h"
38 #include "modules/payments/PaymentsValidators.h" 38 #include "modules/payments/PaymentsValidators.h"
39 #include "mojo/public/cpp/bindings/interface_request.h" 39 #include "mojo/public/cpp/bindings/interface_request.h"
40 #include "platform/RuntimeEnabledFeatures.h" 40 #include "platform/RuntimeEnabledFeatures.h"
41 #include "platform/UUID.h" 41 #include "platform/UUID.h"
42 #include "platform/bindings/ScriptState.h" 42 #include "platform/bindings/ScriptState.h"
43 #include "platform/feature_policy/FeaturePolicy.h"
43 #include "platform/mojo/MojoHelper.h" 44 #include "platform/mojo/MojoHelper.h"
44 #include "platform/wtf/HashSet.h" 45 #include "platform/wtf/HashSet.h"
45 #include "public/platform/InterfaceProvider.h" 46 #include "public/platform/InterfaceProvider.h"
46 #include "public/platform/Platform.h" 47 #include "public/platform/Platform.h"
47 #include "public/platform/WebTraceLocation.h" 48 #include "public/platform/WebTraceLocation.h"
48 49
49 namespace { 50 namespace {
50 51
51 using ::payments::mojom::blink::CanMakePaymentQueryResult; 52 using ::payments::mojom::blink::CanMakePaymentQueryResult;
52 using ::payments::mojom::blink::PaymentAddressPtr; 53 using ::payments::mojom::blink::PaymentAddressPtr;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 593 }
593 594
594 bool AllowedToUsePaymentRequest(const Frame* frame) { 595 bool AllowedToUsePaymentRequest(const Frame* frame) {
595 // To determine whether a Document object |document| is allowed to use the 596 // To determine whether a Document object |document| is allowed to use the
596 // feature indicated by attribute name |allowpaymentrequest|, run these steps: 597 // feature indicated by attribute name |allowpaymentrequest|, run these steps:
597 598
598 // 1. If |document| has no browsing context, then return false. 599 // 1. If |document| has no browsing context, then return false.
599 if (!frame) 600 if (!frame)
600 return false; 601 return false;
601 602
602 if (!RuntimeEnabledFeatures::featurePolicyEnabled()) { 603 if (!IsSupportedInFeaturePolicy(WebFeaturePolicyFeature::kPayment)) {
603 // 2. If |document|'s browsing context is a top-level browsing context, then 604 // 2. If |document|'s browsing context is a top-level browsing context, then
604 // return true. 605 // return true.
605 if (frame->IsMainFrame()) 606 if (frame->IsMainFrame())
606 return true; 607 return true;
607 608
608 // 3. If |document|'s browsing context has a browsing context container that 609 // 3. If |document|'s browsing context has a browsing context container that
609 // is an iframe element with an |allowpaymentrequest| attribute specified, 610 // is an iframe element with an |allowpaymentrequest| attribute specified,
610 // and whose node document is allowed to use the feature indicated by 611 // and whose node document is allowed to use the feature indicated by
611 // |allowpaymentrequest|, then return true. 612 // |allowpaymentrequest|, then return true.
612 if (frame->Owner() && frame->Owner()->AllowPaymentRequest()) 613 if (frame->Owner() && frame->Owner()->AllowPaymentRequest())
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 complete_resolver_.Clear(); 1070 complete_resolver_.Clear();
1070 show_resolver_.Clear(); 1071 show_resolver_.Clear();
1071 abort_resolver_.Clear(); 1072 abort_resolver_.Clear();
1072 can_make_payment_resolver_.Clear(); 1073 can_make_payment_resolver_.Clear();
1073 if (client_binding_.is_bound()) 1074 if (client_binding_.is_bound())
1074 client_binding_.Close(); 1075 client_binding_.Close();
1075 payment_provider_.reset(); 1076 payment_provider_.reset();
1076 } 1077 }
1077 1078
1078 } // namespace blink 1079 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698