OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/onc_utils.h" | 5 #include "chrome/browser/chromeos/net/onc_utils.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
8 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 9 #include "chrome/browser/chromeos/ui_proxy_config.h" |
9 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
10 #include "chromeos/network/onc/onc_utils.h" | 11 #include "chromeos/network/onc/onc_utils.h" |
11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/host_port_pair.h" |
| 14 #include "net/proxy/proxy_bypass_rules.h" |
12 #include "net/proxy/proxy_server.h" | 15 #include "net/proxy/proxy_server.h" |
13 | 16 |
14 namespace chromeos { | 17 namespace chromeos { |
15 namespace onc { | 18 namespace onc { |
16 | 19 |
17 namespace { | 20 namespace { |
18 | 21 |
19 net::ProxyServer ConvertOncProxyLocationToHostPort( | 22 net::ProxyServer ConvertOncProxyLocationToHostPort( |
20 net::ProxyServer::Scheme default_proxy_scheme, | 23 net::ProxyServer::Scheme default_proxy_scheme, |
21 const base::DictionaryValue& onc_proxy_location) { | 24 const base::DictionaryValue& onc_proxy_location) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } else if (onc_scheme == proxy::kSocks) { | 58 } else if (onc_scheme == proxy::kSocks) { |
56 default_proxy_scheme = net::ProxyServer::SCHEME_SOCKS4; | 59 default_proxy_scheme = net::ProxyServer::SCHEME_SOCKS4; |
57 url_scheme = "socks"; | 60 url_scheme = "socks"; |
58 } else { | 61 } else { |
59 NOTREACHED(); | 62 NOTREACHED(); |
60 } | 63 } |
61 | 64 |
62 net::ProxyServer proxy_server = ConvertOncProxyLocationToHostPort( | 65 net::ProxyServer proxy_server = ConvertOncProxyLocationToHostPort( |
63 default_proxy_scheme, *onc_proxy_location); | 66 default_proxy_scheme, *onc_proxy_location); |
64 | 67 |
65 ProxyConfigServiceImpl::ProxyConfig::EncodeAndAppendProxyServer( | 68 UIProxyConfig::EncodeAndAppendProxyServer(url_scheme, proxy_server, spec); |
66 url_scheme, proxy_server, spec); | |
67 } | 69 } |
68 | 70 |
69 net::ProxyBypassRules ConvertOncExcludeDomainsToBypassRules( | 71 net::ProxyBypassRules ConvertOncExcludeDomainsToBypassRules( |
70 const base::ListValue& onc_exclude_domains) { | 72 const base::ListValue& onc_exclude_domains) { |
71 net::ProxyBypassRules rules; | 73 net::ProxyBypassRules rules; |
72 for (base::ListValue::const_iterator it = onc_exclude_domains.begin(); | 74 for (base::ListValue::const_iterator it = onc_exclude_domains.begin(); |
73 it != onc_exclude_domains.end(); ++it) { | 75 it != onc_exclude_domains.end(); ++it) { |
74 std::string rule; | 76 std::string rule; |
75 (*it)->GetAsString(&rule); | 77 (*it)->GetAsString(&rule); |
76 rules.AddRuleFromString(rule); | 78 rules.AddRuleFromString(rule); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 proxy_dict.reset(ProxyConfigDictionary::CreateFixedServers( | 120 proxy_dict.reset(ProxyConfigDictionary::CreateFixedServers( |
119 manual_spec, bypass_rules.ToString())); | 121 manual_spec, bypass_rules.ToString())); |
120 } else { | 122 } else { |
121 NOTREACHED(); | 123 NOTREACHED(); |
122 } | 124 } |
123 return proxy_dict.Pass(); | 125 return proxy_dict.Pass(); |
124 } | 126 } |
125 | 127 |
126 } // namespace onc | 128 } // namespace onc |
127 } // namespace chromeos | 129 } // namespace chromeos |
OLD | NEW |