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

Side by Side Diff: components/content_settings/core/common/content_settings_pattern_parser.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/cloud_devices/common/cloud_devices_urls.cc ('k') | components/cronet/android/test/native_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698