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

Side by Side Diff: net/proxy/proxy_bypass_rules.cc

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « net/http/transport_security_state.cc ('k') | net/server/http_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/proxy/proxy_bypass_rules.h" 5 #include "net/proxy/proxy_bypass_rules.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/pattern.h" 8 #include "base/strings/pattern.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/strings/string_tokenizer.h" 11 #include "base/strings/string_tokenizer.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "net/base/host_port_pair.h" 14 #include "net/base/host_port_pair.h"
15 #include "net/base/ip_address_number.h" 15 #include "net/base/ip_address_number.h"
16 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 namespace { 20 namespace {
21 21
22 class HostnamePatternRule : public ProxyBypassRules::Rule { 22 class HostnamePatternRule : public ProxyBypassRules::Rule {
23 public: 23 public:
24 HostnamePatternRule(const std::string& optional_scheme, 24 HostnamePatternRule(const std::string& optional_scheme,
25 const std::string& hostname_pattern, 25 const std::string& hostname_pattern,
26 int optional_port) 26 int optional_port)
27 : optional_scheme_(base::StringToLowerASCII(optional_scheme)), 27 : optional_scheme_(base::ToLowerASCII(optional_scheme)),
28 hostname_pattern_(base::StringToLowerASCII(hostname_pattern)), 28 hostname_pattern_(base::ToLowerASCII(hostname_pattern)),
29 optional_port_(optional_port) { 29 optional_port_(optional_port) {}
30 }
31 30
32 bool Matches(const GURL& url) const override { 31 bool Matches(const GURL& url) const override {
33 if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_) 32 if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_)
34 return false; // Didn't match port expectation. 33 return false; // Didn't match port expectation.
35 34
36 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_) 35 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_)
37 return false; // Didn't match scheme expectation. 36 return false; // Didn't match scheme expectation.
38 37
39 // Note it is necessary to lower-case the host, since GURL uses capital 38 // Note it is necessary to lower-case the host, since GURL uses capital
40 // letters for percent-escaped characters. 39 // letters for percent-escaped characters.
41 return base::MatchPattern(base::StringToLowerASCII(url.host()), 40 return base::MatchPattern(url.host(), hostname_pattern_);
42 hostname_pattern_);
43 } 41 }
44 42
45 std::string ToString() const override { 43 std::string ToString() const override {
46 std::string str; 44 std::string str;
47 if (!optional_scheme_.empty()) 45 if (!optional_scheme_.empty())
48 base::StringAppendF(&str, "%s://", optional_scheme_.c_str()); 46 base::StringAppendF(&str, "%s://", optional_scheme_.c_str());
49 str += hostname_pattern_; 47 str += hostname_pattern_;
50 if (optional_port_ != -1) 48 if (optional_port_ != -1)
51 base::StringAppendF(&str, ":%d", optional_port_); 49 base::StringAppendF(&str, ":%d", optional_port_);
52 return str; 50 return str;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 return AddRuleForHostname(scheme, raw, port); 339 return AddRuleForHostname(scheme, raw, port);
342 } 340 }
343 341
344 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( 342 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging(
345 const std::string& raw, 343 const std::string& raw,
346 bool use_hostname_suffix_matching) { 344 bool use_hostname_suffix_matching) {
347 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); 345 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching);
348 } 346 }
349 347
350 } // namespace net 348 } // namespace net
OLDNEW
« no previous file with comments | « net/http/transport_security_state.cc ('k') | net/server/http_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698