| 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/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/json/JSONValues.h" | 8 #include "platform/json/JSONValues.h" |
| 9 #include "platform/network/HTTPParsers.h" | 9 #include "platform/network/HTTPParsers.h" |
| 10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (!feature) | 284 if (!feature) |
| 285 continue; | 285 continue; |
| 286 m_headerWhitelists.set(feature, Whitelist::from(parsedDeclaration)); | 286 m_headerWhitelists.set(feature, Whitelist::from(parsedDeclaration)); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 bool FeaturePolicy::isFeatureEnabledForOrigin( | 290 bool FeaturePolicy::isFeatureEnabledForOrigin( |
| 291 const FeaturePolicy::Feature& feature, | 291 const FeaturePolicy::Feature& feature, |
| 292 const SecurityOrigin& origin) const { | 292 const SecurityOrigin& origin) const { |
| 293 DCHECK(m_inheritedFeatures.contains(&feature)); | 293 DCHECK(m_inheritedFeatures.contains(&feature)); |
| 294 if (!m_inheritedFeatures.get(&feature)) { | 294 if (!m_inheritedFeatures.at(&feature)) { |
| 295 return false; | 295 return false; |
| 296 } | 296 } |
| 297 if (m_headerWhitelists.contains(&feature)) { | 297 if (m_headerWhitelists.contains(&feature)) { |
| 298 return m_headerWhitelists.get(&feature)->contains(origin); | 298 return m_headerWhitelists.at(&feature)->contains(origin); |
| 299 } | 299 } |
| 300 if (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForAll) { | 300 if (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForAll) { |
| 301 return true; | 301 return true; |
| 302 } | 302 } |
| 303 if (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForSelf) { | 303 if (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForSelf) { |
| 304 return m_origin->isSameSchemeHostPortAndSuborigin(&origin); | 304 return m_origin->isSameSchemeHostPortAndSuborigin(&origin); |
| 305 } | 305 } |
| 306 return false; | 306 return false; |
| 307 } | 307 } |
| 308 | 308 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 334 sb.append(" "); | 334 sb.append(" "); |
| 335 sb.append(whitelist.key->featureName); | 335 sb.append(whitelist.key->featureName); |
| 336 sb.append(": "); | 336 sb.append(": "); |
| 337 sb.append(whitelist.value->toString()); | 337 sb.append(whitelist.value->toString()); |
| 338 sb.append("\n"); | 338 sb.append("\n"); |
| 339 } | 339 } |
| 340 return sb.toString(); | 340 return sb.toString(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace blink | 343 } // namespace blink |
| OLD | NEW |