| 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 "chromeos/network/onc/onc_utils.h" | 5 #include "chromeos/network/onc/onc_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/base64.h" | 10 #include "base/base64.h" |
| 8 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 12 #include "base/logging.h" |
| 10 #include "base/macros.h" | 13 #include "base/macros.h" |
| 11 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 14 #include "base/values.h" | 17 #include "base/values.h" |
| 15 #include "chromeos/network/network_event_log.h" | 18 #include "chromeos/network/network_event_log.h" |
| 16 #include "chromeos/network/onc/onc_mapper.h" | 19 #include "chromeos/network/onc/onc_mapper.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // Parse |host| according to the format [<scheme>"://"]<server>[":"<port>]. | 764 // Parse |host| according to the format [<scheme>"://"]<server>[":"<port>]. |
| 762 net::ProxyServer proxy_server = | 765 net::ProxyServer proxy_server = |
| 763 net::ProxyServer::FromURI(host, default_proxy_scheme); | 766 net::ProxyServer::FromURI(host, default_proxy_scheme); |
| 764 int port = 0; | 767 int port = 0; |
| 765 onc_proxy_location.GetIntegerWithoutPathExpansion(::onc::proxy::kPort, &port); | 768 onc_proxy_location.GetIntegerWithoutPathExpansion(::onc::proxy::kPort, &port); |
| 766 | 769 |
| 767 // Replace the port parsed from |host| by the provided |port|. | 770 // Replace the port parsed from |host| by the provided |port|. |
| 768 return net::ProxyServer( | 771 return net::ProxyServer( |
| 769 proxy_server.scheme(), | 772 proxy_server.scheme(), |
| 770 net::HostPortPair(proxy_server.host_port_pair().host(), | 773 net::HostPortPair(proxy_server.host_port_pair().host(), |
| 771 static_cast<uint16>(port))); | 774 static_cast<uint16_t>(port))); |
| 772 } | 775 } |
| 773 | 776 |
| 774 void AppendProxyServerForScheme(const base::DictionaryValue& onc_manual, | 777 void AppendProxyServerForScheme(const base::DictionaryValue& onc_manual, |
| 775 const std::string& onc_scheme, | 778 const std::string& onc_scheme, |
| 776 std::string* spec) { | 779 std::string* spec) { |
| 777 const base::DictionaryValue* onc_proxy_location = nullptr; | 780 const base::DictionaryValue* onc_proxy_location = nullptr; |
| 778 if (!onc_manual.GetDictionaryWithoutPathExpansion(onc_scheme, | 781 if (!onc_manual.GetDictionaryWithoutPathExpansion(onc_scheme, |
| 779 &onc_proxy_location)) { | 782 &onc_proxy_location)) { |
| 780 return; | 783 return; |
| 781 } | 784 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 default: { | 983 default: { |
| 981 LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; | 984 LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; |
| 982 return nullptr; | 985 return nullptr; |
| 983 } | 986 } |
| 984 } | 987 } |
| 985 return proxy_settings.Pass(); | 988 return proxy_settings.Pass(); |
| 986 } | 989 } |
| 987 | 990 |
| 988 } // namespace onc | 991 } // namespace onc |
| 989 } // namespace chromeos | 992 } // namespace chromeos |
| OLD | NEW |