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

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

Issue 6314010: Even more reordering the methods in headers and implementation in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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/proxy/polling_proxy_config_service.cc ('k') | net/socket/client_socket_handle.h » ('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_config.h" 5 #include "net/proxy/proxy_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.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 "base/values.h" 10 #include "base/values.h"
(...skipping 14 matching lines...) Expand all
25 } // namespace 25 } // namespace
26 26
27 ProxyConfig::ProxyRules::ProxyRules() 27 ProxyConfig::ProxyRules::ProxyRules()
28 : reverse_bypass(false), 28 : reverse_bypass(false),
29 type(TYPE_NO_RULES) { 29 type(TYPE_NO_RULES) {
30 } 30 }
31 31
32 ProxyConfig::ProxyRules::~ProxyRules() { 32 ProxyConfig::ProxyRules::~ProxyRules() {
33 } 33 }
34 34
35 bool ProxyConfig::ProxyRules::Equals(const ProxyRules& other) const {
36 return type == other.type &&
37 single_proxy == other.single_proxy &&
38 proxy_for_http == other.proxy_for_http &&
39 proxy_for_https == other.proxy_for_https &&
40 proxy_for_ftp == other.proxy_for_ftp &&
41 fallback_proxy == other.fallback_proxy &&
42 bypass_rules.Equals(other.bypass_rules) &&
43 reverse_bypass == other.reverse_bypass;
44 }
45
46 void ProxyConfig::ProxyRules::Apply(const GURL& url, ProxyInfo* result) { 35 void ProxyConfig::ProxyRules::Apply(const GURL& url, ProxyInfo* result) {
47 if (empty()) { 36 if (empty()) {
48 result->UseDirect(); 37 result->UseDirect();
49 return; 38 return;
50 } 39 }
51 40
52 bool bypass_proxy = bypass_rules.Matches(url); 41 bool bypass_proxy = bypass_rules.Matches(url);
53 if (reverse_bypass) 42 if (reverse_bypass)
54 bypass_proxy = !bypass_proxy; 43 bypass_proxy = !bypass_proxy;
55 if (bypass_proxy) { 44 if (bypass_proxy) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const std::string& url_scheme) const { 128 const std::string& url_scheme) const {
140 const ProxyServer* proxy_server = 129 const ProxyServer* proxy_server =
141 const_cast<ProxyRules*>(this)->MapUrlSchemeToProxyNoFallback(url_scheme); 130 const_cast<ProxyRules*>(this)->MapUrlSchemeToProxyNoFallback(url_scheme);
142 if (proxy_server && proxy_server->is_valid()) 131 if (proxy_server && proxy_server->is_valid())
143 return proxy_server; 132 return proxy_server;
144 if (fallback_proxy.is_valid()) 133 if (fallback_proxy.is_valid())
145 return &fallback_proxy; 134 return &fallback_proxy;
146 return NULL; // No mapping for this scheme. Use direct. 135 return NULL; // No mapping for this scheme. Use direct.
147 } 136 }
148 137
138 bool ProxyConfig::ProxyRules::Equals(const ProxyRules& other) const {
139 return type == other.type &&
140 single_proxy == other.single_proxy &&
141 proxy_for_http == other.proxy_for_http &&
142 proxy_for_https == other.proxy_for_https &&
143 proxy_for_ftp == other.proxy_for_ftp &&
144 fallback_proxy == other.fallback_proxy &&
145 bypass_rules.Equals(other.bypass_rules) &&
146 reverse_bypass == other.reverse_bypass;
147 }
148
149 ProxyServer* ProxyConfig::ProxyRules::MapUrlSchemeToProxyNoFallback( 149 ProxyServer* ProxyConfig::ProxyRules::MapUrlSchemeToProxyNoFallback(
150 const std::string& scheme) { 150 const std::string& scheme) {
151 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type); 151 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type);
152 if (scheme == "http") 152 if (scheme == "http")
153 return &proxy_for_http; 153 return &proxy_for_http;
154 if (scheme == "https") 154 if (scheme == "https")
155 return &proxy_for_https; 155 return &proxy_for_https;
156 if (scheme == "ftp") 156 if (scheme == "ftp")
157 return &proxy_for_ftp; 157 return &proxy_for_ftp;
158 return NULL; // No mapping for this scheme. 158 return NULL; // No mapping for this scheme.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 dict->Set("bypass_list", list); 241 dict->Set("bypass_list", list);
242 } 242 }
243 } 243 }
244 244
245 return dict; 245 return dict;
246 } 246 }
247 247
248 } // namespace net 248 } // namespace net
249 249
OLDNEW
« no previous file with comments | « net/proxy/polling_proxy_config_service.cc ('k') | net/socket/client_socket_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698