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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.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, 10 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/bindings/core/v8/ConditionalFeaturesForCore.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
index 0f223d29a575075d9bf584695590bd0075fcca7d..67572f357f2e3a0c8852eac992d0fcb4ca48b4f2 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeaturesForCore.cpp
@@ -11,7 +11,7 @@
#include "bindings/core/v8/V8Navigator.h"
#include "bindings/core/v8/V8Window.h"
#include "core/dom/ExecutionContext.h"
-#include "core/frame/LocalFrame.h"
+#include "core/frame/Frame.h"
#include "core/origin_trials/OriginTrials.h"
namespace blink {
@@ -94,22 +94,17 @@ void installConditionalFeaturesOnWindow(const ScriptState* scriptState) {
v8::Local<v8::Function>());
}
-bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature,
- const LocalFrame* frame) {
- // If there is no frame, or if feature policy is disabled, use defaults.
- bool enabledByDefault =
- (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForAll ||
- (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForSelf &&
- !frame->isCrossOriginSubframe()));
- if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame)
- return enabledByDefault;
- FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy();
+bool isFeatureEnabledInFrame(WebFeaturePolicyFeature feature,
+ const Frame* frame) {
+ DCHECK(frame);
+ WebFeaturePolicy* featurePolicy =
+ frame->securityContext()->getFeaturePolicy();
// The policy should always be initialized before checking it to ensure we
// properly inherit the parent policy.
DCHECK(featurePolicy);
// Otherwise, check policy.
- return featurePolicy->isFeatureEnabled(feature);
+ return featurePolicy->IsFeatureEnabled(feature);
}
void registerInstallConditionalFeaturesForCore() {

Powered by Google App Engine
This is Rietveld 408576698