| OLD | NEW |
| 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/stringprintf.h" | |
| 9 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 10 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
| 11 #include "base/string_tokenizer.h" | |
| 12 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" |
| 12 #include "base/strings/string_tokenizer.h" |
| 13 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class HostnamePatternRule : public ProxyBypassRules::Rule { | 19 class HostnamePatternRule : public ProxyBypassRules::Rule { |
| 20 public: | 20 public: |
| 21 HostnamePatternRule(const std::string& optional_scheme, | 21 HostnamePatternRule(const std::string& optional_scheme, |
| 22 const std::string& hostname_pattern, | 22 const std::string& hostname_pattern, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 it != other.rules_.end(); ++it) { | 244 it != other.rules_.end(); ++it) { |
| 245 rules_.push_back((*it)->Clone()); | 245 rules_.push_back((*it)->Clone()); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 void ProxyBypassRules::ParseFromStringInternal( | 249 void ProxyBypassRules::ParseFromStringInternal( |
| 250 const std::string& raw, | 250 const std::string& raw, |
| 251 bool use_hostname_suffix_matching) { | 251 bool use_hostname_suffix_matching) { |
| 252 Clear(); | 252 Clear(); |
| 253 | 253 |
| 254 StringTokenizer entries(raw, ",;"); | 254 base::StringTokenizer entries(raw, ",;"); |
| 255 while (entries.GetNext()) { | 255 while (entries.GetNext()) { |
| 256 AddRuleFromStringInternalWithLogging(entries.token(), | 256 AddRuleFromStringInternalWithLogging(entries.token(), |
| 257 use_hostname_suffix_matching); | 257 use_hostname_suffix_matching); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool ProxyBypassRules::AddRuleFromStringInternal( | 261 bool ProxyBypassRules::AddRuleFromStringInternal( |
| 262 const std::string& raw_untrimmed, | 262 const std::string& raw_untrimmed, |
| 263 bool use_hostname_suffix_matching) { | 263 bool use_hostname_suffix_matching) { |
| 264 std::string raw; | 264 std::string raw; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return AddRuleForHostname(scheme, raw, port); | 338 return AddRuleForHostname(scheme, raw, port); |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( | 341 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( |
| 342 const std::string& raw, | 342 const std::string& raw, |
| 343 bool use_hostname_suffix_matching) { | 343 bool use_hostname_suffix_matching) { |
| 344 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); | 344 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace net | 347 } // namespace net |
| OLD | NEW |