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

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

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 years, 1 month 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/proxy/multi_threaded_proxy_resolver.cc ('k') | net/proxy/proxy_service.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) 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/proxy/proxy_bypass_rules.h" 5 #include "net/proxy/proxy_bypass_rules.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_tokenizer.h" 8 #include "base/string_tokenizer.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const std::string& raw) { 164 const std::string& raw) {
165 ParseFromStringInternal(raw, true); 165 ParseFromStringInternal(raw, true);
166 } 166 }
167 167
168 bool ProxyBypassRules::AddRuleForHostname(const std::string& optional_scheme, 168 bool ProxyBypassRules::AddRuleForHostname(const std::string& optional_scheme,
169 const std::string& hostname_pattern, 169 const std::string& hostname_pattern,
170 int optional_port) { 170 int optional_port) {
171 if (hostname_pattern.empty()) 171 if (hostname_pattern.empty())
172 return false; 172 return false;
173 173
174 rules_.push_back(new HostnamePatternRule(optional_scheme, 174 rules_.push_back(make_scoped_refptr(new HostnamePatternRule(optional_scheme,
175 hostname_pattern, 175 hostname_pattern,
176 optional_port)); 176 optional_port)));
177 return true; 177 return true;
178 } 178 }
179 179
180 void ProxyBypassRules::AddRuleToBypassLocal() { 180 void ProxyBypassRules::AddRuleToBypassLocal() {
181 rules_.push_back(new BypassLocalRule); 181 rules_.push_back(make_scoped_refptr(new BypassLocalRule));
182 } 182 }
183 183
184 bool ProxyBypassRules::AddRuleFromString(const std::string& raw) { 184 bool ProxyBypassRules::AddRuleFromString(const std::string& raw) {
185 return AddRuleFromStringInternalWithLogging(raw, false); 185 return AddRuleFromStringInternalWithLogging(raw, false);
186 } 186 }
187 187
188 bool ProxyBypassRules::AddRuleFromStringUsingSuffixMatching( 188 bool ProxyBypassRules::AddRuleFromStringUsingSuffixMatching(
189 const std::string& raw) { 189 const std::string& raw) {
190 return AddRuleFromStringInternalWithLogging(raw, true); 190 return AddRuleFromStringInternalWithLogging(raw, true);
191 } 191 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 // If there is a forward slash in the input, it is probably a CIDR style 235 // If there is a forward slash in the input, it is probably a CIDR style
236 // mask. 236 // mask.
237 if (raw.find('/') != std::string::npos) { 237 if (raw.find('/') != std::string::npos) {
238 IPAddressNumber ip_prefix; 238 IPAddressNumber ip_prefix;
239 size_t prefix_length_in_bits; 239 size_t prefix_length_in_bits;
240 240
241 if (!ParseCIDRBlock(raw, &ip_prefix, &prefix_length_in_bits)) 241 if (!ParseCIDRBlock(raw, &ip_prefix, &prefix_length_in_bits))
242 return false; 242 return false;
243 243
244 rules_.push_back( 244 rules_.push_back(make_scoped_refptr(
245 new BypassIPBlockRule(raw, scheme, ip_prefix, prefix_length_in_bits)); 245 new BypassIPBlockRule(raw, scheme, ip_prefix, prefix_length_in_bits)));
246 246
247 return true; 247 return true;
248 } 248 }
249 249
250 // Check if we have an <ip-address>[:port] input. We need to treat this 250 // Check if we have an <ip-address>[:port] input. We need to treat this
251 // separately since the IP literal may not be in a canonical form. 251 // separately since the IP literal may not be in a canonical form.
252 std::string host; 252 std::string host;
253 int port; 253 int port;
254 if (ParseHostAndPort(raw, &host, &port)) { 254 if (ParseHostAndPort(raw, &host, &port)) {
255 if (IsIPAddress(host)) { 255 if (IsIPAddress(host)) {
(...skipping 28 matching lines...) Expand all
284 return AddRuleForHostname(scheme, raw, port); 284 return AddRuleForHostname(scheme, raw, port);
285 } 285 }
286 286
287 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( 287 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging(
288 const std::string& raw, 288 const std::string& raw,
289 bool use_hostname_suffix_matching) { 289 bool use_hostname_suffix_matching) {
290 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); 290 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching);
291 } 291 }
292 292
293 } // namespace net 293 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/multi_threaded_proxy_resolver.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698