| 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() | 132 is_scheme_http = scheme_.IsEmpty() ? policy_->ProtocolEqualsSelf("http") |
| 133 ? policy_->ProtocolEqualsSelf("http") | 133 : EqualIgnoringASCIICase("http", scheme_); |
| 134 : DeprecatedEqualIgnoringCase("http", scheme_); | |
| 135 | 134 |
| 136 if ((port_ == 80 || (port_ == 0 && is_scheme_http)) && | 135 if ((port_ == 80 || (port_ == 0 && is_scheme_http)) && |
| 137 (port == 443 || (port == 0 && DefaultPortForProtocol(protocol) == 443))) | 136 (port == 443 || (port == 0 && DefaultPortForProtocol(protocol) == 443))) |
| 138 return PortMatchingResult::kMatchingUpgrade; | 137 return PortMatchingResult::kMatchingUpgrade; |
| 139 | 138 |
| 140 if (!port) { | 139 if (!port) { |
| 141 if (IsDefaultPortForProtocol(port_, protocol)) | 140 if (IsDefaultPortForProtocol(port_, protocol)) |
| 142 return PortMatchingResult::kMatchingExact; | 141 return PortMatchingResult::kMatchingExact; |
| 143 | 142 |
| 144 return PortMatchingResult::kNotMatching; | 143 return PortMatchingResult::kNotMatching; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 static_cast<WebWildcardDisposition>(port_wildcard_); | 266 static_cast<WebWildcardDisposition>(port_wildcard_); |
| 268 source_expression.path = path_; | 267 source_expression.path = path_; |
| 269 return source_expression; | 268 return source_expression; |
| 270 } | 269 } |
| 271 | 270 |
| 272 DEFINE_TRACE(CSPSource) { | 271 DEFINE_TRACE(CSPSource) { |
| 273 visitor->Trace(policy_); | 272 visitor->Trace(policy_); |
| 274 } | 273 } |
| 275 | 274 |
| 276 } // namespace blink | 275 } // namespace blink |
| OLD | NEW |