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

Side by Side Diff: chrome/browser/importer/firefox_proxy_settings.cc

Issue 12315019: Change ProxyRules to handle ProxyLists rather than just single ProxyServer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
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 "chrome/browser/importer/firefox_proxy_settings.h" 5 #include "chrome/browser/importer/firefox_proxy_settings.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_tokenizer.h" 9 #include "base/strings/string_tokenizer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 // The rest of this funciton is for handling the MANUAL case. 121 // The rest of this funciton is for handling the MANUAL case.
122 DCHECK_EQ(MANUAL, config_type()); 122 DCHECK_EQ(MANUAL, config_type());
123 123
124 *config = net::ProxyConfig(); 124 *config = net::ProxyConfig();
125 config->proxy_rules().type = 125 config->proxy_rules().type =
126 net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME; 126 net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME;
127 127
128 if (!http_proxy().empty()) { 128 if (!http_proxy().empty()) {
129 config->proxy_rules().proxy_for_http = net::ProxyServer( 129 config->proxy_rules().proxies_for_http.SetSingleProxyServer(
130 net::ProxyServer::SCHEME_HTTP, 130 net::ProxyServer(
131 net::HostPortPair(http_proxy(), http_proxy_port())); 131 net::ProxyServer::SCHEME_HTTP,
132 net::HostPortPair(http_proxy(), http_proxy_port())));
132 } 133 }
133 134
134 if (!ftp_proxy().empty()) { 135 if (!ftp_proxy().empty()) {
135 config->proxy_rules().proxy_for_ftp = net::ProxyServer( 136 config->proxy_rules().proxies_for_ftp.SetSingleProxyServer(
136 net::ProxyServer::SCHEME_HTTP, 137 net::ProxyServer(
137 net::HostPortPair(ftp_proxy(), ftp_proxy_port())); 138 net::ProxyServer::SCHEME_HTTP,
139 net::HostPortPair(ftp_proxy(), ftp_proxy_port())));
138 } 140 }
139 141
140 if (!ssl_proxy().empty()) { 142 if (!ssl_proxy().empty()) {
141 config->proxy_rules().proxy_for_https = net::ProxyServer( 143 config->proxy_rules().proxies_for_https.SetSingleProxyServer(
142 net::ProxyServer::SCHEME_HTTP, 144 net::ProxyServer(
143 net::HostPortPair(ssl_proxy(), ssl_proxy_port())); 145 net::ProxyServer::SCHEME_HTTP,
146 net::HostPortPair(ssl_proxy(), ssl_proxy_port())));
144 } 147 }
145 148
146 if (!socks_host().empty()) { 149 if (!socks_host().empty()) {
147 net::ProxyServer::Scheme proxy_scheme = V5 == socks_version() ? 150 net::ProxyServer::Scheme proxy_scheme = V5 == socks_version() ?
148 net::ProxyServer::SCHEME_SOCKS5 : net::ProxyServer::SCHEME_SOCKS4; 151 net::ProxyServer::SCHEME_SOCKS5 : net::ProxyServer::SCHEME_SOCKS4;
149 152
150 config->proxy_rules().fallback_proxy = net::ProxyServer( 153 config->proxy_rules().fallback_proxies.SetSingleProxyServer(
151 proxy_scheme, 154 net::ProxyServer(
152 net::HostPortPair(socks_host(), socks_port())); 155 proxy_scheme,
156 net::HostPortPair(socks_host(), socks_port())));
153 } 157 }
154 158
155 config->proxy_rules().bypass_rules.ParseFromStringUsingSuffixMatching( 159 config->proxy_rules().bypass_rules.ParseFromStringUsingSuffixMatching(
156 JoinString(proxy_bypass_list_, ';')); 160 JoinString(proxy_bypass_list_, ';'));
157 161
158 return true; 162 return true;
159 } 163 }
160 164
161 // static 165 // static
162 bool FirefoxProxySettings::GetSettingsFromFile(const base::FilePath& pref_file, 166 bool FirefoxProxySettings::GetSettingsFromFile(const base::FilePath& pref_file,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 while (string_tok.GetNext()) { 218 while (string_tok.GetNext()) {
215 std::string token = string_tok.token(); 219 std::string token = string_tok.token();
216 TrimWhitespaceASCII(token, TRIM_ALL, &token); 220 TrimWhitespaceASCII(token, TRIM_ALL, &token);
217 if (!token.empty()) 221 if (!token.empty())
218 settings->proxy_bypass_list_.push_back(token); 222 settings->proxy_bypass_list_.push_back(token);
219 } 223 }
220 } 224 }
221 } 225 }
222 return true; 226 return true;
223 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698