| 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/content_security_policy/csp_context.h" | 5 #include "content/common/content_security_policy/csp_context.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 *new_url = new_url->ReplaceComponents(replacements); | 63 *new_url = new_url->ReplaceComponents(replacements); |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CSPContext::SetSelf(const url::Origin origin) { | 70 void CSPContext::SetSelf(const url::Origin origin) { |
| 71 self_source_.reset(); | 71 self_source_.reset(); |
| 72 | 72 |
| 73 // When the origin is unique, no URL should match with 'self'. That's why | 73 // When the origin is opaque, no URL should match with 'self'. That's why |
| 74 // |self_source_| stays undefined here. | 74 // |self_source_| stays undefined here. |
| 75 if (origin.unique()) | 75 if (origin.opaque()) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 if (origin.scheme() == url::kFileScheme) { | 78 if (origin.scheme() == url::kFileScheme) { |
| 79 self_source_ = CSPSource(url::kFileScheme, "", false, url::PORT_UNSPECIFIED, | 79 self_source_ = CSPSource(url::kFileScheme, "", false, url::PORT_UNSPECIFIED, |
| 80 false, ""); | 80 false, ""); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 | 83 |
| 84 self_source_ = CSPSource( | 84 self_source_ = CSPSource( |
| 85 origin.scheme(), origin.host(), false, | 85 origin.scheme(), origin.host(), false, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 disposition(disposition), | 126 disposition(disposition), |
| 127 after_redirect(after_redirect), | 127 after_redirect(after_redirect), |
| 128 source_location(source_location) {} | 128 source_location(source_location) {} |
| 129 | 129 |
| 130 CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) = | 130 CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) = |
| 131 default; | 131 default; |
| 132 | 132 |
| 133 CSPViolationParams::~CSPViolationParams() {} | 133 CSPViolationParams::~CSPViolationParams() {} |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |