| 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 "chrome/browser/chromeos/proxy_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/cros_settings.h" | 9 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | |
| 12 | 11 |
| 13 namespace chromeos { | 12 namespace chromeos { |
| 14 | 13 |
| 15 static const char kProxyPacUrl[] = "cros.session.proxy.pacurl"; | 14 // Common prefix of all proxy prefs. |
| 16 static const char kProxySingleHttp[] = "cros.session.proxy.singlehttp"; | 15 const char kProxyPrefsPrefix[] = "cros.session.proxy"; |
| 17 static const char kProxySingleHttpPort[] = "cros.session.proxy.singlehttpport"; | |
| 18 static const char kProxyHttpUrl[] = "cros.session.proxy.httpurl"; | |
| 19 static const char kProxyHttpPort[] = "cros.session.proxy.httpport"; | |
| 20 static const char kProxyHttpsUrl[] = "cros.session.proxy.httpsurl"; | |
| 21 static const char kProxyHttpsPort[] = "cros.session.proxy.httpsport"; | |
| 22 static const char kProxyType[] = "cros.session.proxy.type"; | |
| 23 static const char kProxySingle[] = "cros.session.proxy.single"; | |
| 24 static const char kProxyFtpUrl[] = "cros.session.proxy.ftpurl"; | |
| 25 static const char kProxyFtpPort[] = "cros.session.proxy.ftpport"; | |
| 26 static const char kProxySocks[] = "cros.session.proxy.socks"; | |
| 27 static const char kProxySocksPort[] = "cros.session.proxy.socksport"; | |
| 28 static const char kProxyIgnoreList[] = "cros.session.proxy.ignorelist"; | |
| 29 | 16 |
| 30 static const char* const kProxySettings[] = { | 17 // Names of proxy preferences. |
| 18 const char kProxyPacUrl[] = "cros.session.proxy.pacurl"; |
| 19 const char kProxySingleHttp[] = "cros.session.proxy.singlehttp"; |
| 20 const char kProxySingleHttpPort[] = "cros.session.proxy.singlehttpport"; |
| 21 const char kProxyHttpUrl[] = "cros.session.proxy.httpurl"; |
| 22 const char kProxyHttpPort[] = "cros.session.proxy.httpport"; |
| 23 const char kProxyHttpsUrl[] = "cros.session.proxy.httpsurl"; |
| 24 const char kProxyHttpsPort[] = "cros.session.proxy.httpsport"; |
| 25 const char kProxyType[] = "cros.session.proxy.type"; |
| 26 const char kProxySingle[] = "cros.session.proxy.single"; |
| 27 const char kProxyFtpUrl[] = "cros.session.proxy.ftpurl"; |
| 28 const char kProxyFtpPort[] = "cros.session.proxy.ftpport"; |
| 29 const char kProxySocks[] = "cros.session.proxy.socks"; |
| 30 const char kProxySocksPort[] = "cros.session.proxy.socksport"; |
| 31 const char kProxyIgnoreList[] = "cros.session.proxy.ignorelist"; |
| 32 |
| 33 const char* const kProxySettings[] = { |
| 31 kProxyPacUrl, | 34 kProxyPacUrl, |
| 32 kProxySingleHttp, | 35 kProxySingleHttp, |
| 33 kProxySingleHttpPort, | 36 kProxySingleHttpPort, |
| 34 kProxyHttpUrl, | 37 kProxyHttpUrl, |
| 35 kProxyHttpPort, | 38 kProxyHttpPort, |
| 36 kProxyHttpsUrl, | 39 kProxyHttpsUrl, |
| 37 kProxyHttpsPort, | 40 kProxyHttpsPort, |
| 38 kProxyType, | 41 kProxyType, |
| 39 kProxySingle, | 42 kProxySingle, |
| 40 kProxyFtpUrl, | 43 kProxyFtpUrl, |
| 41 kProxyFtpPort, | 44 kProxyFtpPort, |
| 42 kProxySocks, | 45 kProxySocks, |
| 43 kProxySocksPort, | 46 kProxySocksPort, |
| 44 kProxyIgnoreList, | 47 kProxyIgnoreList, |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 //------------------ ProxyCrosSettingsProvider: public methods ----------------- | 50 // We have to explicitly export this because the arraysize macro doesn't like |
| 51 // extern arrays as their size is not known on compile time. |
| 52 const size_t kProxySettingsCount = arraysize(kProxySettings); |
| 48 | 53 |
| 49 ProxyCrosSettingsProvider::ProxyCrosSettingsProvider(Profile* profile) | 54 namespace { |
| 50 : profile_(profile) { | 55 |
| 56 base::Value* CreateServerHostValue( |
| 57 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) { |
| 58 return proxy.server.is_valid() ? |
| 59 base::Value::CreateStringValue(proxy.server.host_port_pair().host()) : |
| 60 NULL; |
| 51 } | 61 } |
| 52 | 62 |
| 53 void ProxyCrosSettingsProvider::SetCurrentNetwork(const std::string& network) { | 63 base::Value* CreateServerPortValue( |
| 54 GetConfigService()->UISetCurrentNetwork(network); | 64 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) { |
| 55 for (size_t i = 0; i < arraysize(kProxySettings); ++i) | 65 return proxy.server.is_valid() ? |
| 56 CrosSettings::Get()->FireObservers(kProxySettings[i]); | 66 base::Value::CreateIntegerValue(proxy.server.host_port_pair().port()) : |
| 67 NULL; |
| 57 } | 68 } |
| 58 | 69 |
| 59 void ProxyCrosSettingsProvider::MakeActiveNetworkCurrent() { | 70 net::ProxyServer CreateProxyServer(std::string host, |
| 60 GetConfigService()->UIMakeActiveNetworkCurrent(); | 71 uint16 port, |
| 61 for (size_t i = 0; i < arraysize(kProxySettings); ++i) | 72 net::ProxyServer::Scheme scheme) { |
| 62 CrosSettings::Get()->FireObservers(kProxySettings[i]); | 73 if (host.length() == 0 && port == 0) |
| 74 return net::ProxyServer(); |
| 75 if (port == 0) |
| 76 port = net::ProxyServer::GetDefaultPortForScheme(scheme); |
| 77 net::HostPortPair host_port_pair(host, port); |
| 78 return net::ProxyServer(scheme, host_port_pair); |
| 63 } | 79 } |
| 64 | 80 |
| 65 void ProxyCrosSettingsProvider::DoSet(const std::string& path, | 81 net::ProxyServer CreateProxyServerFromHost( |
| 66 Value* in_value) { | 82 const std::string& host, |
| 83 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 84 net::ProxyServer::Scheme scheme) { |
| 85 uint16 port = 0; |
| 86 if (proxy.server.is_valid()) |
| 87 port = proxy.server.host_port_pair().port(); |
| 88 return CreateProxyServer(host, port, scheme); |
| 89 } |
| 90 |
| 91 net::ProxyServer CreateProxyServerFromPort( |
| 92 uint16 port, |
| 93 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 94 net::ProxyServer::Scheme scheme) { |
| 95 std::string host; |
| 96 if (proxy.server.is_valid()) |
| 97 host = proxy.server.host_port_pair().host(); |
| 98 return CreateProxyServer(host, port, scheme); |
| 99 } |
| 100 |
| 101 } // namespace |
| 102 |
| 103 namespace proxy_cros_settings_parser { |
| 104 |
| 105 bool IsProxyPref(const std::string& path) { |
| 106 return StartsWithASCII(path, kProxyPrefsPrefix, true); |
| 107 } |
| 108 |
| 109 void SetProxyPrefValue(Profile* profile, |
| 110 const std::string& path, |
| 111 const base::Value* in_value) { |
| 67 if (!in_value) { | 112 if (!in_value) { |
| 113 NOTREACHED(); |
| 68 return; | 114 return; |
| 69 } | 115 } |
| 70 | 116 |
| 71 chromeos::ProxyConfigServiceImpl* config_service = GetConfigService(); | 117 chromeos::ProxyConfigServiceImpl* config_service = |
| 118 profile->GetProxyConfigTracker(); |
| 72 // Retrieve proxy config. | 119 // Retrieve proxy config. |
| 73 chromeos::ProxyConfigServiceImpl::ProxyConfig config; | 120 chromeos::ProxyConfigServiceImpl::ProxyConfig config; |
| 74 config_service->UIGetProxyConfig(&config); | 121 config_service->UIGetProxyConfig(&config); |
| 75 | 122 |
| 76 if (path == kProxyPacUrl) { | 123 if (path == kProxyPacUrl) { |
| 77 std::string val; | 124 std::string val; |
| 78 if (in_value->GetAsString(&val)) { | 125 if (in_value->GetAsString(&val)) { |
| 79 GURL url(val); | 126 GURL url(val); |
| 80 if (url.is_valid()) | 127 if (url.is_valid()) |
| 81 config_service->UISetProxyConfigToPACScript(url); | 128 config_service->UISetProxyConfigToPACScript(url); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (in_value->GetAsInteger(&val)) { | 251 if (in_value->GetAsInteger(&val)) { |
| 205 std::string host = config.socks_proxy.server.host_port_pair().host(); | 252 std::string host = config.socks_proxy.server.host_port_pair().host(); |
| 206 config_service->UISetProxyConfigToProxyPerScheme("socks", | 253 config_service->UISetProxyConfigToProxyPerScheme("socks", |
| 207 CreateProxyServerFromPort(val, config.socks_proxy, | 254 CreateProxyServerFromPort(val, config.socks_proxy, |
| 208 StartsWithASCII(host, "socks5://", false) ? | 255 StartsWithASCII(host, "socks5://", false) ? |
| 209 net::ProxyServer::SCHEME_SOCKS5 : | 256 net::ProxyServer::SCHEME_SOCKS5 : |
| 210 net::ProxyServer::SCHEME_SOCKS4)); | 257 net::ProxyServer::SCHEME_SOCKS4)); |
| 211 } | 258 } |
| 212 } else if (path == kProxyIgnoreList) { | 259 } else if (path == kProxyIgnoreList) { |
| 213 net::ProxyBypassRules bypass_rules; | 260 net::ProxyBypassRules bypass_rules; |
| 214 if (in_value->GetType() == Value::TYPE_LIST) { | 261 if (in_value->GetType() == base::Value::TYPE_LIST) { |
| 215 const ListValue* list_value = static_cast<const ListValue*>(in_value); | 262 const ListValue* list_value = static_cast<const ListValue*>(in_value); |
| 216 for (size_t x = 0; x < list_value->GetSize(); x++) { | 263 for (size_t x = 0; x < list_value->GetSize(); x++) { |
| 217 std::string val; | 264 std::string val; |
| 218 if (list_value->GetString(x, &val)) { | 265 if (list_value->GetString(x, &val)) { |
| 219 bypass_rules.AddRuleFromString(val); | 266 bypass_rules.AddRuleFromString(val); |
| 220 } | 267 } |
| 221 } | 268 } |
| 222 config_service->UISetProxyConfigBypassRules(bypass_rules); | 269 config_service->UISetProxyConfigBypassRules(bypass_rules); |
| 223 } | 270 } |
| 224 } | 271 } |
| 225 } | 272 } |
| 226 | 273 |
| 227 bool ProxyCrosSettingsProvider::Get(const std::string& path, | 274 bool GetProxyPrefValue(Profile* profile, |
| 228 Value** out_value) const { | 275 const std::string& path, |
| 276 base::Value** out_value) { |
| 229 bool found = false; | 277 bool found = false; |
| 230 bool managed = false; | 278 bool managed = false; |
| 231 std::string controlled_by; | 279 std::string controlled_by; |
| 232 Value* data = NULL; | 280 base::Value* data = NULL; |
| 233 chromeos::ProxyConfigServiceImpl* config_service = GetConfigService(); | 281 chromeos::ProxyConfigServiceImpl* config_service = |
| 282 profile->GetProxyConfigTracker(); |
| 234 chromeos::ProxyConfigServiceImpl::ProxyConfig config; | 283 chromeos::ProxyConfigServiceImpl::ProxyConfig config; |
| 235 config_service->UIGetProxyConfig(&config); | 284 config_service->UIGetProxyConfig(&config); |
| 236 | 285 |
| 237 if (path == kProxyPacUrl) { | 286 if (path == kProxyPacUrl) { |
| 238 // Only show pacurl for pac-script mode. | 287 // Only show pacurl for pac-script mode. |
| 239 if (config.mode == | 288 if (config.mode == |
| 240 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT && | 289 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT && |
| 241 config.automatic_proxy.pac_url.is_valid()) { | 290 config.automatic_proxy.pac_url.is_valid()) { |
| 242 data = Value::CreateStringValue(config.automatic_proxy.pac_url.spec()); | 291 data = |
| 292 base::Value::CreateStringValue(config.automatic_proxy.pac_url.spec()); |
| 243 } | 293 } |
| 244 found = true; | 294 found = true; |
| 245 } else if (path == kProxySingleHttp) { | 295 } else if (path == kProxySingleHttp) { |
| 246 data = CreateServerHostValue(config.single_proxy); | 296 data = CreateServerHostValue(config.single_proxy); |
| 247 found = true; | 297 found = true; |
| 248 } else if (path == kProxySingleHttpPort) { | 298 } else if (path == kProxySingleHttpPort) { |
| 249 data = CreateServerPortValue(config.single_proxy); | 299 data = CreateServerPortValue(config.single_proxy); |
| 250 found = true; | 300 found = true; |
| 251 } else if (path == kProxyHttpUrl) { | 301 } else if (path == kProxyHttpUrl) { |
| 252 data = CreateServerHostValue(config.http_proxy); | 302 data = CreateServerHostValue(config.http_proxy); |
| 253 found = true; | 303 found = true; |
| 254 } else if (path == kProxyHttpsUrl) { | 304 } else if (path == kProxyHttpsUrl) { |
| 255 data = CreateServerHostValue(config.https_proxy); | 305 data = CreateServerHostValue(config.https_proxy); |
| 256 found = true; | 306 found = true; |
| 257 } else if (path == kProxyType) { | 307 } else if (path == kProxyType) { |
| 258 if (config.mode == | 308 if (config.mode == |
| 259 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_AUTO_DETECT || | 309 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_AUTO_DETECT || |
| 260 config.mode == | 310 config.mode == |
| 261 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT) { | 311 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT) { |
| 262 data = Value::CreateIntegerValue(3); | 312 data = base::Value::CreateIntegerValue(3); |
| 263 } else if (config.mode == | 313 } else if (config.mode == |
| 264 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY || | 314 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY || |
| 265 config.mode == | 315 config.mode == |
| 266 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PROXY_PER_SCHEME) { | 316 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PROXY_PER_SCHEME) { |
| 267 data = Value::CreateIntegerValue(2); | 317 data = base::Value::CreateIntegerValue(2); |
| 268 } else { | 318 } else { |
| 269 data = Value::CreateIntegerValue(1); | 319 data = base::Value::CreateIntegerValue(1); |
| 270 } | 320 } |
| 271 switch (config.state) { | 321 switch (config.state) { |
| 272 case ProxyPrefs::CONFIG_POLICY: | 322 case ProxyPrefs::CONFIG_POLICY: |
| 273 controlled_by = "policyManagedPrefsBannerText"; | 323 controlled_by = "policyManagedPrefsBannerText"; |
| 274 break; | 324 break; |
| 275 case ProxyPrefs::CONFIG_EXTENSION: | 325 case ProxyPrefs::CONFIG_EXTENSION: |
| 276 controlled_by = "extensionManagedPrefsBannerText"; | 326 controlled_by = "extensionManagedPrefsBannerText"; |
| 277 break; | 327 break; |
| 278 case ProxyPrefs::CONFIG_OTHER_PRECEDE: | 328 case ProxyPrefs::CONFIG_OTHER_PRECEDE: |
| 279 controlled_by = "unmodifiablePrefsBannerText"; | 329 controlled_by = "unmodifiablePrefsBannerText"; |
| 280 break; | 330 break; |
| 281 default: | 331 default: |
| 282 if (!config.user_modifiable) | 332 if (!config.user_modifiable) |
| 283 controlled_by = "enableSharedProxiesBannerText"; | 333 controlled_by = "enableSharedProxiesBannerText"; |
| 284 break; | 334 break; |
| 285 } | 335 } |
| 286 found = true; | 336 found = true; |
| 287 } else if (path == kProxySingle) { | 337 } else if (path == kProxySingle) { |
| 288 data = Value::CreateBooleanValue(config.mode == | 338 data = base::Value::CreateBooleanValue(config.mode == |
| 289 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY); | 339 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY); |
| 290 found = true; | 340 found = true; |
| 291 } else if (path == kProxyFtpUrl) { | 341 } else if (path == kProxyFtpUrl) { |
| 292 data = CreateServerHostValue(config.ftp_proxy); | 342 data = CreateServerHostValue(config.ftp_proxy); |
| 293 found = true; | 343 found = true; |
| 294 } else if (path == kProxySocks) { | 344 } else if (path == kProxySocks) { |
| 295 data = CreateServerHostValue(config.socks_proxy); | 345 data = CreateServerHostValue(config.socks_proxy); |
| 296 found = true; | 346 found = true; |
| 297 } else if (path == kProxyHttpPort) { | 347 } else if (path == kProxyHttpPort) { |
| 298 data = CreateServerPortValue(config.http_proxy); | 348 data = CreateServerPortValue(config.http_proxy); |
| 299 found = true; | 349 found = true; |
| 300 } else if (path == kProxyHttpsPort) { | 350 } else if (path == kProxyHttpsPort) { |
| 301 data = CreateServerPortValue(config.https_proxy); | 351 data = CreateServerPortValue(config.https_proxy); |
| 302 found = true; | 352 found = true; |
| 303 } else if (path == kProxyFtpPort) { | 353 } else if (path == kProxyFtpPort) { |
| 304 data = CreateServerPortValue(config.ftp_proxy); | 354 data = CreateServerPortValue(config.ftp_proxy); |
| 305 found = true; | 355 found = true; |
| 306 } else if (path == kProxySocksPort) { | 356 } else if (path == kProxySocksPort) { |
| 307 data = CreateServerPortValue(config.socks_proxy); | 357 data = CreateServerPortValue(config.socks_proxy); |
| 308 found = true; | 358 found = true; |
| 309 } else if (path == kProxyIgnoreList) { | 359 } else if (path == kProxyIgnoreList) { |
| 310 ListValue* list = new ListValue(); | 360 ListValue* list = new ListValue(); |
| 311 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules(); | 361 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules(); |
| 312 for (size_t x = 0; x < bypass_rules.size(); x++) { | 362 for (size_t x = 0; x < bypass_rules.size(); x++) { |
| 313 list->Append(Value::CreateStringValue(bypass_rules[x]->ToString())); | 363 list->Append(base::Value::CreateStringValue(bypass_rules[x]->ToString())); |
| 314 } | 364 } |
| 315 *out_value = list; | 365 *out_value = list; |
| 316 return true; | 366 return true; |
| 317 } | 367 } |
| 318 if (found) { | 368 if (found) { |
| 319 DictionaryValue* dict = new DictionaryValue; | 369 DictionaryValue* dict = new DictionaryValue; |
| 320 if (!data) | 370 if (!data) |
| 321 data = Value::CreateStringValue(""); | 371 data = base::Value::CreateStringValue(""); |
| 322 dict->Set("value", data); | 372 dict->Set("value", data); |
| 323 dict->SetBoolean("managed", managed); | 373 dict->SetBoolean("managed", managed); |
| 324 if (path == kProxyType) { | 374 if (path == kProxyType) { |
| 325 dict->SetString("controlledBy", controlled_by); | 375 dict->SetString("controlledBy", controlled_by); |
| 326 dict->SetBoolean("disabled", !config.user_modifiable); | 376 dict->SetBoolean("disabled", !config.user_modifiable); |
| 327 } | 377 } |
| 328 *out_value = dict; | 378 *out_value = dict; |
| 329 return true; | 379 return true; |
| 330 } else { | 380 } else { |
| 331 *out_value = NULL; | 381 *out_value = NULL; |
| 332 return false; | 382 return false; |
| 333 } | 383 } |
| 334 } | 384 } |
| 335 | 385 |
| 336 bool ProxyCrosSettingsProvider::HandlesSetting(const std::string& path) const { | 386 } // namespace proxy_cros_settings_parser |
| 337 return ::StartsWithASCII(path, "cros.session.proxy", true); | |
| 338 } | |
| 339 | |
| 340 //----------------- ProxyCrosSettingsProvider: private methods ----------------- | |
| 341 | |
| 342 chromeos::ProxyConfigServiceImpl* | |
| 343 ProxyCrosSettingsProvider::GetConfigService() const { | |
| 344 return profile_->GetProxyConfigTracker(); | |
| 345 } | |
| 346 | |
| 347 net::ProxyServer ProxyCrosSettingsProvider::CreateProxyServerFromHost( | |
| 348 const std::string& host, | |
| 349 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | |
| 350 net::ProxyServer::Scheme scheme) const { | |
| 351 uint16 port = 0; | |
| 352 if (proxy.server.is_valid()) | |
| 353 port = proxy.server.host_port_pair().port(); | |
| 354 return CreateProxyServer(host, port, scheme); | |
| 355 } | |
| 356 | |
| 357 net::ProxyServer ProxyCrosSettingsProvider::CreateProxyServerFromPort( | |
| 358 uint16 port, | |
| 359 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | |
| 360 net::ProxyServer::Scheme scheme) const { | |
| 361 std::string host; | |
| 362 if (proxy.server.is_valid()) | |
| 363 host = proxy.server.host_port_pair().host(); | |
| 364 return CreateProxyServer(host, port, scheme); | |
| 365 } | |
| 366 | |
| 367 net::ProxyServer ProxyCrosSettingsProvider::CreateProxyServer( | |
| 368 std::string host, | |
| 369 uint16 port, | |
| 370 net::ProxyServer::Scheme scheme) const { | |
| 371 if (host.length() == 0 && port == 0) | |
| 372 return net::ProxyServer(); | |
| 373 if (port == 0) | |
| 374 port = net::ProxyServer::GetDefaultPortForScheme(scheme); | |
| 375 net::HostPortPair host_port_pair(host, port); | |
| 376 return net::ProxyServer(scheme, host_port_pair); | |
| 377 } | |
| 378 | |
| 379 Value* ProxyCrosSettingsProvider::CreateServerHostValue( | |
| 380 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const { | |
| 381 return proxy.server.is_valid() ? | |
| 382 Value::CreateStringValue(proxy.server.host_port_pair().host()) : | |
| 383 NULL; | |
| 384 } | |
| 385 | |
| 386 Value* ProxyCrosSettingsProvider::CreateServerPortValue( | |
| 387 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const { | |
| 388 return proxy.server.is_valid() ? | |
| 389 Value::CreateIntegerValue(proxy.server.host_port_pair().port()) : | |
| 390 NULL; | |
| 391 } | |
| 392 | 387 |
| 393 } // namespace chromeos | 388 } // namespace chromeos |
| OLD | NEW |