| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/frame/csp/CSPSource.h" | 5 #include "core/frame/csp/CSPSource.h" |
| 6 | 6 |
| 7 #include "core/frame/UseCounter.h" | 7 #include "core/frame/UseCounter.h" |
| 8 #include "core/frame/csp/ContentSecurityPolicy.h" | 8 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
| 10 #include "platform/weborigin/KnownPorts.h" | 10 #include "platform/weborigin/KnownPorts.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (port_wildcard_ == kHasWildcard) | 122 if (port_wildcard_ == kHasWildcard) |
| 123 return PortMatchingResult::kMatchingWildcard; | 123 return PortMatchingResult::kMatchingWildcard; |
| 124 | 124 |
| 125 if (port == port_) { | 125 if (port == port_) { |
| 126 if (port == 0) | 126 if (port == 0) |
| 127 return PortMatchingResult::kMatchingWildcard; | 127 return PortMatchingResult::kMatchingWildcard; |
| 128 return PortMatchingResult::kMatchingExact; | 128 return PortMatchingResult::kMatchingExact; |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool is_scheme_http; // needed for detecting an upgrade when the port is 0 | 131 bool is_scheme_http; // needed for detecting an upgrade when the port is 0 |
| 132 is_scheme_http = scheme_.IsEmpty() ? policy_->ProtocolEqualsSelf("http") | 132 is_scheme_http = scheme_.IsEmpty() |
| 133 : EqualIgnoringCase("http", scheme_); | 133 ? policy_->ProtocolEqualsSelf("http") |
| 134 : DeprecatedEqualIgnoringCase("http", scheme_); |
| 134 | 135 |
| 135 if ((port_ == 80 || (port_ == 0 && is_scheme_http)) && | 136 if ((port_ == 80 || (port_ == 0 && is_scheme_http)) && |
| 136 (port == 443 || (port == 0 && DefaultPortForProtocol(protocol) == 443))) | 137 (port == 443 || (port == 0 && DefaultPortForProtocol(protocol) == 443))) |
| 137 return PortMatchingResult::kMatchingUpgrade; | 138 return PortMatchingResult::kMatchingUpgrade; |
| 138 | 139 |
| 139 if (!port) { | 140 if (!port) { |
| 140 if (IsDefaultPortForProtocol(port_, protocol)) | 141 if (IsDefaultPortForProtocol(port_, protocol)) |
| 141 return PortMatchingResult::kMatchingExact; | 142 return PortMatchingResult::kMatchingExact; |
| 142 | 143 |
| 143 return PortMatchingResult::kNotMatching; | 144 return PortMatchingResult::kNotMatching; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 static_cast<WebWildcardDisposition>(port_wildcard_); | 267 static_cast<WebWildcardDisposition>(port_wildcard_); |
| 267 source_expression.path = path_; | 268 source_expression.path = path_; |
| 268 return source_expression; | 269 return source_expression; |
| 269 } | 270 } |
| 270 | 271 |
| 271 DEFINE_TRACE(CSPSource) { | 272 DEFINE_TRACE(CSPSource) { |
| 272 visitor->Trace(policy_); | 273 visitor->Trace(policy_); |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace blink | 276 } // namespace blink |
| OLD | NEW |