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

Side by Side Diff: net/base/ip_mapping_rules.cc

Issue 183853011: Move TrimWhitespace to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/host_mapping_rules.cc ('k') | net/base/net_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ip_mapping_rules.h" 5 #include "net/base/ip_mapping_rules.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 addresses->insert(addresses->begin(), 59 addresses->insert(addresses->begin(),
60 IPEndPoint((*rule_it)->replacement_address(), port)); 60 IPEndPoint((*rule_it)->replacement_address(), port));
61 return true; 61 return true;
62 } 62 }
63 } 63 }
64 return false; 64 return false;
65 } 65 }
66 66
67 bool IPMappingRules::AddRuleFromString(const std::string& rule_string) { 67 bool IPMappingRules::AddRuleFromString(const std::string& rule_string) {
68 std::string trimmed; 68 std::string trimmed;
69 TrimWhitespaceASCII(rule_string, TRIM_ALL, &trimmed); 69 base::TrimWhitespaceASCII(rule_string, base::TRIM_ALL, &trimmed);
70 if (trimmed.empty()) 70 if (trimmed.empty())
71 return true; // Allow empty rules. 71 return true; // Allow empty rules.
72 72
73 std::vector<std::string> parts; 73 std::vector<std::string> parts;
74 base::SplitString(trimmed, ' ', &parts); 74 base::SplitString(trimmed, ' ', &parts);
75 75
76 if (parts.size() != 3) { 76 if (parts.size() != 3) {
77 DVLOG(1) << "Rule has wrong number of parts: " << rule_string; 77 DVLOG(1) << "Rule has wrong number of parts: " << rule_string;
78 return false; 78 return false;
79 } 79 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!AddRuleFromString(rules.token())) { 111 if (!AddRuleFromString(rules.token())) {
112 DVLOG(1) << "Failed parsing rule: " << rules.token(); 112 DVLOG(1) << "Failed parsing rule: " << rules.token();
113 STLDeleteElements(&rules_); 113 STLDeleteElements(&rules_);
114 return false; 114 return false;
115 } 115 }
116 } 116 }
117 return true; 117 return true;
118 } 118 }
119 119
120 } // namespace net 120 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_mapping_rules.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698