| OLD | NEW |
| 1 // Copyright (c) 2010 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-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_tokenizer.h" | 9 #include "base/string_tokenizer.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 bool ProxyBypassRules::AddRuleFromString(const std::string& raw) { | 213 bool ProxyBypassRules::AddRuleFromString(const std::string& raw) { |
| 214 return AddRuleFromStringInternalWithLogging(raw, false); | 214 return AddRuleFromStringInternalWithLogging(raw, false); |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool ProxyBypassRules::AddRuleFromStringUsingSuffixMatching( | 217 bool ProxyBypassRules::AddRuleFromStringUsingSuffixMatching( |
| 218 const std::string& raw) { | 218 const std::string& raw) { |
| 219 return AddRuleFromStringInternalWithLogging(raw, true); | 219 return AddRuleFromStringInternalWithLogging(raw, true); |
| 220 } | 220 } |
| 221 | 221 |
| 222 std::string ProxyBypassRules::ToString() const { |
| 223 std::string result; |
| 224 for (RuleList::const_iterator rule(rules_.begin()); |
| 225 rule != rules_.end(); |
| 226 ++rule) { |
| 227 result += (*rule)->ToString(); |
| 228 result += ";"; |
| 229 } |
| 230 return result; |
| 231 } |
| 232 |
| 222 void ProxyBypassRules::Clear() { | 233 void ProxyBypassRules::Clear() { |
| 223 STLDeleteElements(&rules_); | 234 STLDeleteElements(&rules_); |
| 224 } | 235 } |
| 225 | 236 |
| 226 void ProxyBypassRules::AssignFrom(const ProxyBypassRules& other) { | 237 void ProxyBypassRules::AssignFrom(const ProxyBypassRules& other) { |
| 227 Clear(); | 238 Clear(); |
| 228 | 239 |
| 229 // Make a copy of the rules list. | 240 // Make a copy of the rules list. |
| 230 for (RuleList::const_iterator it = other.rules_.begin(); | 241 for (RuleList::const_iterator it = other.rules_.begin(); |
| 231 it != other.rules_.end(); ++it) { | 242 it != other.rules_.end(); ++it) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return AddRuleForHostname(scheme, raw, port); | 334 return AddRuleForHostname(scheme, raw, port); |
| 324 } | 335 } |
| 325 | 336 |
| 326 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( | 337 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( |
| 327 const std::string& raw, | 338 const std::string& raw, |
| 328 bool use_hostname_suffix_matching) { | 339 bool use_hostname_suffix_matching) { |
| 329 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); | 340 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); |
| 330 } | 341 } |
| 331 | 342 |
| 332 } // namespace net | 343 } // namespace net |
| OLD | NEW |