Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
raymes
2017/01/25 01:00:42
nit 2017
iclelland
2017/01/25 03:28:38
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/child/feature_policy/feature_policy_platform.h" | |
| 6 | |
| 7 namespace content { | |
| 8 | |
| 9 ParsedFeaturePolicyHeader FeaturePolicyHeaderFromWeb( | |
| 10 const blink::WebParsedFeaturePolicyHeader& web_feature_policy_header) { | |
| 11 ParsedFeaturePolicyHeader result; | |
| 12 for (const blink::WebParsedFeaturePolicyDeclaration& web_declaration : | |
| 13 web_feature_policy_header) { | |
| 14 ParsedFeaturePolicyDeclaration declaration; | |
| 15 declaration.feature_name = web_declaration.featureName.utf8(); | |
| 16 declaration.matches_all_origins = web_declaration.matchesAllOrigins; | |
| 17 for (const blink::WebSecurityOrigin& web_origin : web_declaration.origins) | |
| 18 declaration.origins.push_back(web_origin); | |
| 19 result.push_back(declaration); | |
| 20 } | |
| 21 return result; | |
| 22 } | |
| 23 | |
| 24 blink::WebParsedFeaturePolicyHeader FeaturePolicyHeaderToWeb( | |
| 25 const ParsedFeaturePolicyHeader& feature_policy_header) { | |
| 26 std::vector<blink::WebParsedFeaturePolicyDeclaration> result; | |
| 27 for (const ParsedFeaturePolicyDeclaration& declaration : | |
| 28 feature_policy_header) { | |
| 29 blink::WebParsedFeaturePolicyDeclaration web_declaration; | |
| 30 web_declaration.featureName = | |
| 31 blink::WebString::fromUTF8(declaration.feature_name); | |
| 32 web_declaration.matchesAllOrigins = declaration.matches_all_origins; | |
| 33 std::vector<blink::WebSecurityOrigin> web_origins; | |
| 34 for (const url::Origin& origin : declaration.origins) | |
| 35 web_origins.push_back(origin); | |
| 36 web_declaration.origins = web_origins; | |
| 37 result.push_back(web_declaration); | |
| 38 } | |
| 39 return result; | |
| 40 } | |
| 41 | |
| 42 } // namespace content | |
| OLD | NEW |