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

Side by Side Diff: content/renderer/content_security_policy_util.cc

Issue 2756913002: Revert of PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Created 3 years, 9 months 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 | « content/renderer/content_security_policy_util.h ('k') | content/renderer/render_frame_impl.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 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/renderer/content_security_policy_util.h" 5 #include "content/renderer/content_security_policy_util.h"
6 #include "third_party/WebKit/public/platform/WebContentSecurityPolicyStruct.h"
6 7
7 namespace content { 8 namespace content {
8 9
9 CSPSource BuildCSPSource( 10 CSPSource BuildCSPSource(
10 const blink::WebContentSecurityPolicySourceExpression& source) { 11 const blink::WebContentSecurityPolicySourceExpression& source) {
11 return CSPSource( 12 return CSPSource(
12 source.scheme.utf8(), // scheme 13 source.scheme.utf8(), // scheme
13 source.host.utf8(), // host 14 source.host.utf8(), // host
14 source.isHostWildcard == blink::WebWildcardDispositionHasWildcard, 15 source.isHostWildcard == blink::WebWildcardDispositionHasWildcard,
15 source.port == 0 ? url::PORT_UNSPECIFIED : source.port, // port 16 source.port == 0 ? url::PORT_UNSPECIFIED : source.port, // port
(...skipping 30 matching lines...) Expand all
46 for (const blink::WebString& endpoint : policy.reportEndpoints) 47 for (const blink::WebString& endpoint : policy.reportEndpoints)
47 report_endpoints.push_back(endpoint.utf8()); 48 report_endpoints.push_back(endpoint.utf8());
48 49
49 return ContentSecurityPolicy(policy.disposition, // disposition 50 return ContentSecurityPolicy(policy.disposition, // disposition
50 policy.source, // source 51 policy.source, // source
51 directives, // directives 52 directives, // directives
52 report_endpoints, // report_endpoints 53 report_endpoints, // report_endpoints
53 policy.header.utf8()); // header 54 policy.header.utf8()); // header
54 } 55 }
55 56
56 blink::WebContentSecurityPolicyViolation BuildWebContentSecurityPolicyViolation(
57 const content::CSPViolationParams& violation_params) {
58 blink::WebContentSecurityPolicyViolation violation;
59 violation.directive = blink::WebString::fromASCII(violation_params.directive);
60 violation.effectiveDirective =
61 blink::WebString::fromASCII(violation_params.effective_directive);
62 violation.consoleMessage =
63 blink::WebString::fromASCII(violation_params.console_message);
64 violation.blockedUrl = violation_params.blocked_url;
65 violation.reportEndpoints = blink::WebVector<blink::WebString>(
66 violation_params.report_endpoints.size());
67 for (size_t i = 0; i < violation_params.report_endpoints.size(); ++i) {
68 violation.reportEndpoints[i] =
69 blink::WebString::fromASCII(violation_params.report_endpoints[i]);
70 }
71 violation.header = blink::WebString::fromASCII(violation_params.header);
72 violation.disposition = violation_params.disposition;
73 violation.afterRedirect = violation_params.after_redirect;
74 return violation;
75 }
76
77 } // namespace content 57 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/content_security_policy_util.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698