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

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

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « net/dns/mock_host_resolver.cc ('k') | url/origin.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/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
10 #include "base/strings/string_tokenizer.h" 11 #include "base/strings/string_tokenizer.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "net/base/host_port_pair.h" 14 #include "net/base/host_port_pair.h"
14 #include "net/base/ip_address_number.h" 15 #include "net/base/ip_address_number.h"
15 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
16 17
17 namespace net { 18 namespace net {
(...skipping 12 matching lines...) Expand all
30 31
31 bool Matches(const GURL& url) const override { 32 bool Matches(const GURL& url) const override {
32 if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_) 33 if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_)
33 return false; // Didn't match port expectation. 34 return false; // Didn't match port expectation.
34 35
35 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_) 36 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_)
36 return false; // Didn't match scheme expectation. 37 return false; // Didn't match scheme expectation.
37 38
38 // Note it is necessary to lower-case the host, since GURL uses capital 39 // Note it is necessary to lower-case the host, since GURL uses capital
39 // letters for percent-escaped characters. 40 // letters for percent-escaped characters.
40 return MatchPattern(base::StringToLowerASCII(url.host()), 41 return base::MatchPattern(base::StringToLowerASCII(url.host()),
41 hostname_pattern_); 42 hostname_pattern_);
42 } 43 }
43 44
44 std::string ToString() const override { 45 std::string ToString() const override {
45 std::string str; 46 std::string str;
46 if (!optional_scheme_.empty()) 47 if (!optional_scheme_.empty())
47 base::StringAppendF(&str, "%s://", optional_scheme_.c_str()); 48 base::StringAppendF(&str, "%s://", optional_scheme_.c_str());
48 str += hostname_pattern_; 49 str += hostname_pattern_;
49 if (optional_port_ != -1) 50 if (optional_port_ != -1)
50 base::StringAppendF(&str, ":%d", optional_port_); 51 base::StringAppendF(&str, ":%d", optional_port_);
51 return str; 52 return str;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return AddRuleForHostname(scheme, raw, port); 340 return AddRuleForHostname(scheme, raw, port);
340 } 341 }
341 342
342 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( 343 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging(
343 const std::string& raw, 344 const std::string& raw,
344 bool use_hostname_suffix_matching) { 345 bool use_hostname_suffix_matching) {
345 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); 346 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching);
346 } 347 }
347 348
348 } // namespace net 349 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/mock_host_resolver.cc ('k') | url/origin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698