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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp

Issue 2481653002: Move FeaturePolicy object to SecurityContext (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/SecurityContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/ConditionalFeatures.h" 5 #include "bindings/core/v8/ConditionalFeatures.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8Document.h" 8 #include "bindings/core/v8/V8Document.h"
9 #include "bindings/core/v8/V8HTMLLinkElement.h" 9 #include "bindings/core/v8/V8HTMLLinkElement.h"
10 #include "bindings/core/v8/V8Navigator.h" 10 #include "bindings/core/v8/V8Navigator.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 v8::Local<v8::Function>()); 92 v8::Local<v8::Function>());
93 } 93 }
94 94
95 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature, 95 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature,
96 const LocalFrame* frame) { 96 const LocalFrame* frame) {
97 // If there is no frame, or if feature policy is disabled, use defaults. 97 // If there is no frame, or if feature policy is disabled, use defaults.
98 bool enabledByDefault = 98 bool enabledByDefault =
99 (feature.defaultPolicy != FeaturePolicy::FeatureDefault::DisableForAll); 99 (feature.defaultPolicy != FeaturePolicy::FeatureDefault::DisableForAll);
100 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame) 100 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame)
101 return enabledByDefault; 101 return enabledByDefault;
102 FeaturePolicy* featurePolicy = frame->getFeaturePolicy(); 102 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy();
103 if (!featurePolicy) 103 if (!featurePolicy)
104 return enabledByDefault; 104 return enabledByDefault;
105 105
106 // Otherwise, check policy. 106 // Otherwise, check policy.
107 return featurePolicy->isFeatureEnabled(feature); 107 return featurePolicy->isFeatureEnabled(feature);
108 } 108 }
109 109
110 } // namespace blink 110 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/SecurityContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698