| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base/host_mapping_rules.h" | 5 #include "net/base/host_mapping_rules.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/string_tokenizer.h" | |
| 10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/strings/string_tokenizer.h" |
| 11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 struct HostMappingRules::MapRule { | 16 struct HostMappingRules::MapRule { |
| 17 MapRule() : replacement_port(-1) {} | 17 MapRule() : replacement_port(-1) {} |
| 18 | 18 |
| 19 std::string hostname_pattern; | 19 std::string hostname_pattern; |
| 20 std::string replacement_hostname; | 20 std::string replacement_hostname; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void HostMappingRules::SetRulesFromString(const std::string& rules_string) { | 99 void HostMappingRules::SetRulesFromString(const std::string& rules_string) { |
| 100 exclusion_rules_.clear(); | 100 exclusion_rules_.clear(); |
| 101 map_rules_.clear(); | 101 map_rules_.clear(); |
| 102 | 102 |
| 103 StringTokenizer rules(rules_string, ","); | 103 base::StringTokenizer rules(rules_string, ","); |
| 104 while (rules.GetNext()) { | 104 while (rules.GetNext()) { |
| 105 bool ok = AddRuleFromString(rules.token()); | 105 bool ok = AddRuleFromString(rules.token()); |
| 106 LOG_IF(ERROR, !ok) << "Failed parsing rule: " << rules.token(); | 106 LOG_IF(ERROR, !ok) << "Failed parsing rule: " << rules.token(); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace net | 110 } // namespace net |
| OLD | NEW |