OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/common/feature_policy/feature_policy.h" | 5 #include "content/common/feature_policy/feature_policy.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 const ParsedFeaturePolicyHeader& parsed_header) { | 139 const ParsedFeaturePolicyHeader& parsed_header) { |
140 DCHECK(whitelists_.empty()); | 140 DCHECK(whitelists_.empty()); |
141 for (const ParsedFeaturePolicyDeclaration& parsed_declaration : | 141 for (const ParsedFeaturePolicyDeclaration& parsed_declaration : |
142 parsed_header) { | 142 parsed_header) { |
143 blink::WebFeaturePolicyFeature feature = parsed_declaration.feature; | 143 blink::WebFeaturePolicyFeature feature = parsed_declaration.feature; |
144 DCHECK(feature != blink::WebFeaturePolicyFeature::kNotFound); | 144 DCHECK(feature != blink::WebFeaturePolicyFeature::kNotFound); |
145 whitelists_[feature] = WhitelistFromDeclaration(parsed_declaration); | 145 whitelists_[feature] = WhitelistFromDeclaration(parsed_declaration); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 bool FeaturePolicy::HasSetHeaderPolicy() const { | |
150 return !whitelists_.empty(); | |
alexmos
2017/05/17 22:48:49
Can you set an empty policy in the header, one tha
raymes
2017/05/21 22:11:20
Ahh good catch. I've removed this for now, as righ
alexmos
2017/05/22 23:05:47
I'm fine leaving it out until there's a more subst
| |
151 } | |
152 | |
149 FeaturePolicy::FeaturePolicy(url::Origin origin, | 153 FeaturePolicy::FeaturePolicy(url::Origin origin, |
150 const FeatureList& feature_list) | 154 const FeatureList& feature_list) |
151 : origin_(origin), feature_list_(feature_list) {} | 155 : origin_(origin), feature_list_(feature_list) {} |
152 | 156 |
153 FeaturePolicy::FeaturePolicy(url::Origin origin) | 157 FeaturePolicy::FeaturePolicy(url::Origin origin) |
154 : origin_(origin), feature_list_(GetDefaultFeatureList()) {} | 158 : origin_(origin), feature_list_(GetDefaultFeatureList()) {} |
155 | 159 |
156 FeaturePolicy::~FeaturePolicy() {} | 160 FeaturePolicy::~FeaturePolicy() {} |
157 | 161 |
158 // static | 162 // static |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 {blink::WebFeaturePolicyFeature::kSyncXHR, | 239 {blink::WebFeaturePolicyFeature::kSyncXHR, |
236 FeaturePolicy::FeatureDefault::EnableForAll}, | 240 FeaturePolicy::FeatureDefault::EnableForAll}, |
237 {blink::WebFeaturePolicyFeature::kWebRTC, | 241 {blink::WebFeaturePolicyFeature::kWebRTC, |
238 FeaturePolicy::FeatureDefault::EnableForAll}, | 242 FeaturePolicy::FeatureDefault::EnableForAll}, |
239 {blink::WebFeaturePolicyFeature::kUsb, | 243 {blink::WebFeaturePolicyFeature::kUsb, |
240 FeaturePolicy::FeatureDefault::EnableForSelf}})); | 244 FeaturePolicy::FeatureDefault::EnableForSelf}})); |
241 return default_feature_list; | 245 return default_feature_list; |
242 } | 246 } |
243 | 247 |
244 } // namespace content | 248 } // namespace content |
OLD | NEW |