Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "components/proxy_config/proxy_config_dictionary.h" | 5 #include "components/proxy_config/proxy_config_dictionary.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/proxy/proxy_config.h" | |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 // Integer to specify the type of proxy settings. | 14 // Integer to specify the type of proxy settings. |
| 14 // See ProxyPrefs for possible values and interactions with the other proxy | 15 // See ProxyPrefs for possible values and interactions with the other proxy |
| 15 // preferences. | 16 // preferences. |
| 16 const char kProxyMode[] = "mode"; | 17 const char kProxyMode[] = "mode"; |
| 17 // String specifying the proxy server. For a specification of the expected | 18 // String specifying the proxy server. For a specification of the expected |
| 18 // syntax see net::ProxyConfig::ProxyRules::ParseFromString(). | 19 // syntax see net::ProxyConfig::ProxyRules::ParseFromString(). |
| 19 const char kProxyServer[] = "server"; | 20 const char kProxyServer[] = "server"; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 if (!pac_url.empty()) { | 135 if (!pac_url.empty()) { |
| 135 dict->SetString(kProxyPacUrl, pac_url); | 136 dict->SetString(kProxyPacUrl, pac_url); |
| 136 dict->SetBoolean(kProxyPacMandatory, pac_mandatory); | 137 dict->SetBoolean(kProxyPacMandatory, pac_mandatory); |
| 137 } | 138 } |
| 138 if (!proxy_server.empty()) | 139 if (!proxy_server.empty()) |
| 139 dict->SetString(kProxyServer, proxy_server); | 140 dict->SetString(kProxyServer, proxy_server); |
| 140 if (!bypass_list.empty()) | 141 if (!bypass_list.empty()) |
| 141 dict->SetString(kProxyBypassList, bypass_list); | 142 dict->SetString(kProxyBypassList, bypass_list); |
| 142 return dict; | 143 return dict; |
| 143 } | 144 } |
| 145 | |
| 146 // static | |
| 147 void ProxyConfigDictionary::EncodeAndAppendProxyServer( | |
| 148 const std::string& url_scheme, | |
| 149 const net::ProxyServer& server, | |
| 150 std::string* spec) { | |
|
jochen (gone - plz use gerrit)
2015/07/08 13:20:15
why not return a string?
stevenjb
2015/07/08 16:26:15
I just moved this so that it could be used outside
| |
| 151 if (!server.is_valid()) | |
| 152 return; | |
| 153 | |
| 154 if (!spec->empty()) | |
| 155 *spec += ';'; | |
| 156 | |
| 157 if (!url_scheme.empty()) { | |
| 158 *spec += url_scheme; | |
| 159 *spec += "="; | |
| 160 } | |
| 161 *spec += server.ToURI(); | |
| 162 } | |
| OLD | NEW |