OLD | NEW |
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 "platform/feature_policy/FeaturePolicy.h" | 5 #include "platform/feature_policy/FeaturePolicy.h" |
6 | 6 |
7 #include "platform/json/JSONValues.h" | 7 #include "platform/json/JSONValues.h" |
8 #include "platform/network/HTTPParsers.h" | 8 #include "platform/network/HTTPParsers.h" |
9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
10 #include "platform/weborigin/SecurityOrigin.h" | 10 #include "platform/weborigin/SecurityOrigin.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return defaultFeatureList; | 120 return defaultFeatureList; |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
124 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( | 124 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( |
125 const FeaturePolicy* parent, | 125 const FeaturePolicy* parent, |
126 RefPtr<SecurityOrigin> currentOrigin, | 126 RefPtr<SecurityOrigin> currentOrigin, |
127 FeaturePolicy::FeatureList& features) { | 127 FeaturePolicy::FeatureList& features) { |
128 DCHECK(currentOrigin); | 128 DCHECK(currentOrigin); |
129 std::unique_ptr<FeaturePolicy> newPolicy = | 129 std::unique_ptr<FeaturePolicy> newPolicy = |
130 wrapUnique(new FeaturePolicy(currentOrigin, features)); | 130 WTF::wrapUnique(new FeaturePolicy(currentOrigin, features)); |
131 for (const FeaturePolicy::Feature* feature : features) { | 131 for (const FeaturePolicy::Feature* feature : features) { |
132 if (!parent || | 132 if (!parent || |
133 parent->isFeatureEnabledForOrigin(*feature, *currentOrigin)) { | 133 parent->isFeatureEnabledForOrigin(*feature, *currentOrigin)) { |
134 newPolicy->m_inheritedFeatures.set(feature, true); | 134 newPolicy->m_inheritedFeatures.set(feature, true); |
135 } else { | 135 } else { |
136 newPolicy->m_inheritedFeatures.set(feature, false); | 136 newPolicy->m_inheritedFeatures.set(feature, false); |
137 } | 137 } |
138 } | 138 } |
139 return newPolicy; | 139 return newPolicy; |
140 } | 140 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 sb.append(" "); | 269 sb.append(" "); |
270 sb.append(whitelist.key->featureName); | 270 sb.append(whitelist.key->featureName); |
271 sb.append(": "); | 271 sb.append(": "); |
272 sb.append(whitelist.value->toString()); | 272 sb.append(whitelist.value->toString()); |
273 sb.append("\n"); | 273 sb.append("\n"); |
274 } | 274 } |
275 return sb.toString(); | 275 return sb.toString(); |
276 } | 276 } |
277 | 277 |
278 } // namespace blink | 278 } // namespace blink |
OLD | NEW |