OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/content_settings/core/common/content_settings_pattern_parse
r.h" | 5 #include "components/content_settings/core/common/content_settings_pattern_parse
r.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "url/url_constants.h" | 8 #include "url/url_constants.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 } else { | 124 } else { |
125 builder->WithSchemeWildcard(); | 125 builder->WithSchemeWildcard(); |
126 } | 126 } |
127 | 127 |
128 if (host_component.IsNonEmpty()) { | 128 if (host_component.IsNonEmpty()) { |
129 std::string host = pattern_spec.substr(host_component.start, | 129 std::string host = pattern_spec.substr(host_component.start, |
130 host_component.len); | 130 host_component.len); |
131 if (host == kHostWildcard) { | 131 if (host == kHostWildcard) { |
132 builder->WithDomainWildcard(); | 132 builder->WithDomainWildcard(); |
133 } else if (base::StartsWithASCII(host, kDomainWildcard, true)) { | 133 } else if (base::StartsWith(host, kDomainWildcard, |
| 134 base::CompareCase::SENSITIVE)) { |
134 host = host.substr(kDomainWildcardLength); | 135 host = host.substr(kDomainWildcardLength); |
135 builder->WithDomainWildcard(); | 136 builder->WithDomainWildcard(); |
136 builder->WithHost(host); | 137 builder->WithHost(host); |
137 } else { | 138 } else { |
138 // If the host contains a wildcard symbol then it is invalid. | 139 // If the host contains a wildcard symbol then it is invalid. |
139 if (host.find(kHostWildcard) != std::string::npos) { | 140 if (host.find(kHostWildcard) != std::string::npos) { |
140 builder->Invalid(); | 141 builder->Invalid(); |
141 return; | 142 return; |
142 } | 143 } |
143 builder->WithHost(host); | 144 builder->WithHost(host); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 213 } |
213 | 214 |
214 if (!parts.is_port_wildcard) { | 215 if (!parts.is_port_wildcard) { |
215 str += std::string(kUrlPortSeparator) + parts.port; | 216 str += std::string(kUrlPortSeparator) + parts.port; |
216 } | 217 } |
217 | 218 |
218 return str; | 219 return str; |
219 } | 220 } |
220 | 221 |
221 } // namespace content_settings | 222 } // namespace content_settings |
OLD | NEW |