summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-06-11 18:57:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-12 01:59:01 +0000
commit44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2 (patch)
tree30eccdbbe72fb47810535fe56e0a8313be2db4b2 /net
parent57ca2cd795596162f06a6aa67367d8ce0d9ded52 (diff)
downloadchromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.zip
chromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.tar.gz
chromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.tar.bz2
Move StartsWith[ASCII] to base namespace.
NOPRESUBMIT=true (no presubmit due to removing base:: from a ScopedAllowIO) Review URL: https://codereview.chromium.org/1172183002 Cr-Commit-Position: refs/heads/master@{#334108}
Diffstat (limited to 'net')
-rw-r--r--net/base/mime_util.cc8
-rw-r--r--net/base/net_util.cc2
-rw-r--r--net/base/net_util_icu.cc8
-rw-r--r--net/dns/host_resolver_impl.cc2
-rw-r--r--net/filter/filter.cc2
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware.cc2
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms.cc2
-rw-r--r--net/http/http_auth_cache.cc2
-rw-r--r--net/http/http_response_headers.cc4
-rw-r--r--net/http/http_stream_factory.cc2
-rw-r--r--net/http/http_util.cc4
-rw-r--r--net/proxy/proxy_bypass_rules.cc4
-rw-r--r--net/proxy/proxy_config_service_linux.cc2
-rw-r--r--net/server/http_server_unittest.cc13
-rw-r--r--net/ssl/ssl_cipher_suite_names.cc3
-rw-r--r--net/test/embedded_test_server/embedded_test_server.cc2
-rw-r--r--net/tools/quic/quic_in_memory_cache.cc4
17 files changed, 35 insertions, 31 deletions
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 4c0d1e0..4468fc4 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -283,7 +283,7 @@ bool MimeUtil::MatchesMimeType(const std::string& mime_type_pattern,
const std::string left(base_pattern.substr(0, star));
const std::string right(base_pattern.substr(star + 1));
- if (!StartsWithASCII(base_type, left, false))
+ if (!base::StartsWithASCII(base_type, left, false))
return false;
if (!right.empty() && !EndsWith(base_type, right, false))
@@ -330,7 +330,8 @@ bool MimeUtil::IsValidTopLevelMimeType(const std::string& type_string) const {
return true;
}
- return type_string.size() > 2 && StartsWithASCII(type_string, "x-", false);
+ return type_string.size() > 2 &&
+ base::StartsWithASCII(type_string, "x-", false);
}
//----------------------------------------------------------------------------
@@ -457,7 +458,8 @@ void GetExtensionsFromHardCodedMappings(
const std::string& leading_mime_type,
base::hash_set<base::FilePath::StringType>* extensions) {
for (size_t i = 0; i < mappings_len; ++i) {
- if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) {
+ if (base::StartsWithASCII(mappings[i].mime_type, leading_mime_type,
+ false)) {
std::vector<string> this_extensions;
base::SplitString(mappings[i].extensions, ',', &this_extensions);
for (size_t j = 0; j < this_extensions.size(); ++j) {
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 8820611..04733a8 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -256,7 +256,7 @@ bool IsCanonicalizedHostCompliant(const std::string& host) {
base::string16 StripWWW(const base::string16& text) {
const base::string16 www(base::ASCIIToUTF16("www."));
- return StartsWith(text, www, true) ? text.substr(www.length()) : text;
+ return base::StartsWith(text, www, true) ? text.substr(www.length()) : text;
}
base::string16 StripWWWFromHost(const GURL& url) {
diff --git a/net/base/net_util_icu.cc b/net/base/net_util_icu.cc
index 08be72f..01204a3 100644
--- a/net/base/net_util_icu.cc
+++ b/net/base/net_util_icu.cc
@@ -679,7 +679,8 @@ base::string16 FormatUrlWithAdjustments(
// Reject "view-source:view-source:..." to avoid deep recursion.
const char kViewSourceTwice[] = "view-source:view-source:";
if (url.SchemeIs(kViewSource) &&
- !StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice, false)) {
+ !base::StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice,
+ false)) {
return FormatViewSourceUrl(url, languages, format_types,
unescape_rules, new_parsed, prefix_end,
adjustments);
@@ -705,7 +706,7 @@ base::string16 FormatUrlWithAdjustments(
// we avoid stripping "http://" in this case.
bool omit_http = (format_types & kFormatUrlOmitHTTP) &&
base::EqualsASCII(url_string, kHTTP) &&
- !StartsWithASCII(url.host(), kFTP, true);
+ !base::StartsWithASCII(url.host(), kFTP, true);
new_parsed->scheme = parsed.scheme;
// Username & password.
@@ -792,7 +793,8 @@ base::string16 FormatUrlWithAdjustments(
&url_string, &new_parsed->ref, adjustments);
// If we need to strip out http do it after the fact.
- if (omit_http && StartsWith(url_string, base::ASCIIToUTF16(kHTTP), true)) {
+ if (omit_http &&
+ base::StartsWith(url_string, base::ASCIIToUTF16(kHTTP), true)) {
const size_t kHTTPSize = arraysize(kHTTP) - 1;
url_string = url_string.substr(kHTTPSize);
// Because offsets in the |adjustments| are already calculated with respect
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 970ec1f..a074c3e 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -281,7 +281,7 @@ bool ConfigureAsyncDnsNoFallbackFieldTrial() {
// otherwise (trial absent): return default.
std::string group_name = base::FieldTrialList::FindFullName("AsyncDns");
if (!group_name.empty())
- return StartsWithASCII(group_name, "AsyncDnsNoFallback", false);
+ return base::StartsWithASCII(group_name, "AsyncDnsNoFallback", false);
return kDefault;
}
diff --git a/net/filter/filter.cc b/net/filter/filter.cc
index 4df0191..0e6544b 100644
--- a/net/filter/filter.cc
+++ b/net/filter/filter.cc
@@ -267,7 +267,7 @@ void Filter::FixupEncodingTypes(
// supported server side on paths that only send HTML content, this mode has
// never surfaced in the wild (and is unlikely to).
// We will gather a lot of stats as we perform the fixups
- if (StartsWithASCII(mime_type, kTextHtml, false)) {
+ if (base::StartsWithASCII(mime_type, kTextHtml, false)) {
// Suspicious case: Advertised dictionary, but server didn't use sdch, and
// we're HTML tagged.
if (encoding_types->empty()) {
diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc
index 20716ab..e8b635d 100644
--- a/net/ftp/ftp_directory_listing_parser_netware.cc
+++ b/net/ftp/ftp_directory_listing_parser_netware.cc
@@ -40,7 +40,7 @@ bool ParseFtpDirectoryListingNetware(
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries) {
if (!lines.empty() &&
- !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) {
+ !base::StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) {
return false;
}
diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc
index d73a54f..fb5ee47 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms.cc
@@ -210,7 +210,7 @@ bool ParseFtpDirectoryListingVms(
if (lines[i].empty())
continue;
- if (StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) {
+ if (base::StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) {
// After the "total" line, all following lines must be empty.
for (size_t j = i + 1; j < lines.size(); j++)
if (!lines[j].empty())
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc
index 51f9035..106e1ec 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -37,7 +37,7 @@ void CheckPathIsValid(const std::string& path) {
bool IsEnclosingPath(const std::string& container, const std::string& path) {
DCHECK(container.empty() || *(container.end() - 1) == '/');
return ((container.empty() && path.empty()) ||
- (!container.empty() && StartsWithASCII(path, container, true)));
+ (!container.empty() && base::StartsWithASCII(path, container, true)));
}
// Debug helper to check that |origin| arguments are properly formed.
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 257a88c..e729db3 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -102,8 +102,8 @@ bool ShouldUpdateHeader(const std::string::const_iterator& name_begin,
return false;
}
for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) {
- if (StartsWithASCII(std::string(name_begin, name_end),
- kNonUpdatedHeaderPrefixes[i], false))
+ if (base::StartsWithASCII(std::string(name_begin, name_end),
+ kNonUpdatedHeaderPrefixes[i], false))
return false;
}
return true;
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index 35083f0..e3d35b7 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -39,7 +39,7 @@ void HttpStreamFactory::ProcessAlternateProtocol(
bool is_valid = true;
for (size_t i = 0; i < alternate_protocol_values.size(); ++i) {
const std::string& alternate_protocol_str = alternate_protocol_values[i];
- if (StartsWithASCII(alternate_protocol_str, "p=", true)) {
+ if (base::StartsWithASCII(alternate_protocol_str, "p=", true)) {
if (!base::StringToDouble(alternate_protocol_str.substr(2),
&probability) ||
probability < 0 || probability > 1) {
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index fa40ed7..b3819c21 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -353,8 +353,8 @@ const char* const kForbiddenHeaderFields[] = {
// static
bool HttpUtil::IsSafeHeader(const std::string& name) {
std::string lower_name(base::StringToLowerASCII(name));
- if (StartsWithASCII(lower_name, "proxy-", true) ||
- StartsWithASCII(lower_name, "sec-", true))
+ if (base::StartsWithASCII(lower_name, "proxy-", true) ||
+ base::StartsWithASCII(lower_name, "sec-", true))
return false;
for (size_t i = 0; i < arraysize(kForbiddenHeaderFields); ++i) {
if (lower_name == kForbiddenHeaderFields[i])
diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc
index bb163ad..9dc40315 100644
--- a/net/proxy/proxy_bypass_rules.cc
+++ b/net/proxy/proxy_bypass_rules.cc
@@ -328,12 +328,12 @@ bool ProxyBypassRules::AddRuleFromStringInternal(
// Special-case hostnames that begin with a period.
// For example, we remap ".google.com" --> "*.google.com".
- if (StartsWithASCII(raw, ".", false))
+ if (base::StartsWithASCII(raw, ".", false))
raw = "*" + raw;
// If suffix matching was asked for, make sure the pattern starts with a
// wildcard.
- if (use_hostname_suffix_matching && !StartsWithASCII(raw, "*", false))
+ if (use_hostname_suffix_matching && !base::StartsWithASCII(raw, "*", false))
raw = "*" + raw;
return AddRuleForHostname(scheme, raw, port);
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index be8068d..58ae1df 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -55,7 +55,7 @@ namespace {
std::string FixupProxyHostScheme(ProxyServer::Scheme scheme,
std::string host) {
if (scheme == ProxyServer::SCHEME_SOCKS5 &&
- StartsWithASCII(host, "socks4://", false)) {
+ base::StartsWithASCII(host, "socks4://", false)) {
// We default to socks 5, but if the user specifically set it to
// socks4://, then use that.
scheme = ProxyServer::SCHEME_SOCKS4;
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index aebe593..09b6bf4 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -270,9 +270,8 @@ TEST_F(HttpServerTest, Request) {
ASSERT_EQ("/test", GetRequest(0).path);
ASSERT_EQ("", GetRequest(0).data);
ASSERT_EQ(0u, GetRequest(0).headers.size());
- ASSERT_TRUE(StartsWithASCII(GetRequest(0).peer.ToString(),
- "127.0.0.1",
- true));
+ ASSERT_TRUE(
+ base::StartsWithASCII(GetRequest(0).peer.ToString(), "127.0.0.1", true));
}
TEST_F(HttpServerTest, RequestWithHeaders) {
@@ -443,7 +442,7 @@ TEST_F(HttpServerTest, Send200) {
std::string response;
ASSERT_TRUE(client.ReadResponse(&response));
- ASSERT_TRUE(StartsWithASCII(response, "HTTP/1.1 200 OK", true));
+ ASSERT_TRUE(base::StartsWithASCII(response, "HTTP/1.1 200 OK", true));
ASSERT_TRUE(EndsWith(response, "Response!", true));
}
@@ -592,7 +591,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) {
server_->Send200(client_connection_id, "Content for /test", "text/plain");
std::string response1;
ASSERT_TRUE(client.ReadResponse(&response1));
- ASSERT_TRUE(StartsWithASCII(response1, "HTTP/1.1 200 OK", true));
+ ASSERT_TRUE(base::StartsWithASCII(response1, "HTTP/1.1 200 OK", true));
ASSERT_TRUE(EndsWith(response1, "Content for /test", true));
client.Send("GET /test2 HTTP/1.1\r\n\r\n");
@@ -603,7 +602,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) {
server_->Send404(client_connection_id);
std::string response2;
ASSERT_TRUE(client.ReadResponse(&response2));
- ASSERT_TRUE(StartsWithASCII(response2, "HTTP/1.1 404 Not Found", true));
+ ASSERT_TRUE(base::StartsWithASCII(response2, "HTTP/1.1 404 Not Found", true));
client.Send("GET /test3 HTTP/1.1\r\n\r\n");
ASSERT_TRUE(RunUntilRequestsReceived(3));
@@ -613,7 +612,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) {
server_->Send200(client_connection_id, "Content for /test3", "text/plain");
std::string response3;
ASSERT_TRUE(client.ReadResponse(&response3));
- ASSERT_TRUE(StartsWithASCII(response3, "HTTP/1.1 200 OK", true));
+ ASSERT_TRUE(base::StartsWithASCII(response3, "HTTP/1.1 200 OK", true));
ASSERT_TRUE(EndsWith(response3, "Content for /test3", true));
}
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc
index 87a3259..6a2dff1 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -349,7 +349,8 @@ bool ParseSSLCipherString(const std::string& cipher_string,
uint16* cipher_suite) {
int value = 0;
if (cipher_string.size() == 6 &&
- StartsWithASCII(cipher_string, "0x", false /* case insensitive */) &&
+ base::StartsWithASCII(cipher_string, "0x",
+ false /* case insensitive */) &&
base::HexStringToInt(cipher_string, &value)) {
*cipher_suite = static_cast<uint16>(value);
return true;
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc
index a6e95ae..e90ff2c 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -263,7 +263,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection,
GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const {
DCHECK(Started()) << "You must start the server first.";
- DCHECK(StartsWithASCII(relative_url, "/", true /* case_sensitive */))
+ DCHECK(base::StartsWithASCII(relative_url, "/", true /* case_sensitive */))
<< relative_url;
return base_url_.Resolve(relative_url);
}
diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc
index 302e198..8bf1713 100644
--- a/net/tools/quic/quic_in_memory_cache.cc
+++ b/net/tools/quic/quic_in_memory_cache.cc
@@ -128,9 +128,9 @@ void QuicInMemoryCache::InitializeFromDirectory(const string& cache_directory) {
if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) {
response_headers->RemoveHeader("X-Original-Url");
// Remove the protocol so we can add it below.
- if (StartsWithASCII(base, "https://", false)) {
+ if (base::StartsWithASCII(base, "https://", false)) {
base = base.substr(8);
- } else if (StartsWithASCII(base, "http://", false)) {
+ } else if (base::StartsWithASCII(base, "http://", false)) {
base = base.substr(7);
}
} else {