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> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chromeos/network/onc/onc_normalizer.h" | 29 #include "chromeos/network/onc/onc_normalizer.h" |
30 #include "chromeos/network/onc/onc_signature.h" | 30 #include "chromeos/network/onc/onc_signature.h" |
31 #include "chromeos/network/onc/onc_translator.h" | 31 #include "chromeos/network/onc/onc_translator.h" |
32 #include "chromeos/network/onc/onc_utils.h" | 32 #include "chromeos/network/onc/onc_utils.h" |
33 #include "chromeos/network/onc/onc_validator.h" | 33 #include "chromeos/network/onc/onc_validator.h" |
34 #include "components/device_event_log/device_event_log.h" | 34 #include "components/device_event_log/device_event_log.h" |
35 #include "components/onc/onc_pref_names.h" | 35 #include "components/onc/onc_pref_names.h" |
36 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
37 #include "components/proxy_config/proxy_config_dictionary.h" | 37 #include "components/proxy_config/proxy_config_dictionary.h" |
38 #include "components/signin/core/account_id/account_id.h" | 38 #include "components/signin/core/account_id/account_id.h" |
| 39 #include "components/url_formatter/url_fixer.h" |
39 #include "components/user_manager/user.h" | 40 #include "components/user_manager/user.h" |
40 #include "components/user_manager/user_manager.h" | 41 #include "components/user_manager/user_manager.h" |
41 #include "crypto/encryptor.h" | 42 #include "crypto/encryptor.h" |
42 #include "crypto/hmac.h" | 43 #include "crypto/hmac.h" |
43 #include "crypto/symmetric_key.h" | 44 #include "crypto/symmetric_key.h" |
44 #include "net/base/host_port_pair.h" | 45 #include "net/base/host_port_pair.h" |
45 #include "net/cert/pem_tokenizer.h" | 46 #include "net/cert/pem_tokenizer.h" |
46 #include "net/cert/x509_certificate.h" | 47 #include "net/cert/x509_certificate.h" |
47 #include "net/proxy/proxy_bypass_rules.h" | 48 #include "net/proxy/proxy_bypass_rules.h" |
48 #include "net/proxy/proxy_config.h" | 49 #include "net/proxy/proxy_config.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 std::unique_ptr<base::DictionaryValue> proxy_dict; | 924 std::unique_ptr<base::DictionaryValue> proxy_dict; |
924 | 925 |
925 if (type == ::onc::proxy::kDirect) { | 926 if (type == ::onc::proxy::kDirect) { |
926 proxy_dict.reset(ProxyConfigDictionary::CreateDirect()); | 927 proxy_dict.reset(ProxyConfigDictionary::CreateDirect()); |
927 } else if (type == ::onc::proxy::kWPAD) { | 928 } else if (type == ::onc::proxy::kWPAD) { |
928 proxy_dict.reset(ProxyConfigDictionary::CreateAutoDetect()); | 929 proxy_dict.reset(ProxyConfigDictionary::CreateAutoDetect()); |
929 } else if (type == ::onc::proxy::kPAC) { | 930 } else if (type == ::onc::proxy::kPAC) { |
930 std::string pac_url; | 931 std::string pac_url; |
931 onc_proxy_settings.GetStringWithoutPathExpansion(::onc::proxy::kPAC, | 932 onc_proxy_settings.GetStringWithoutPathExpansion(::onc::proxy::kPAC, |
932 &pac_url); | 933 &pac_url); |
933 GURL url(pac_url); | 934 GURL url(url_formatter::FixupURL(pac_url, std::string())); |
934 DCHECK(url.is_valid()) << "Invalid URL in ProxySettings.PAC"; | 935 proxy_dict.reset(ProxyConfigDictionary::CreatePacScript( |
935 proxy_dict.reset(ProxyConfigDictionary::CreatePacScript(url.spec(), false)); | 936 url.is_valid() ? url.spec() : std::string(), false)); |
936 } else if (type == ::onc::proxy::kManual) { | 937 } else if (type == ::onc::proxy::kManual) { |
937 const base::DictionaryValue* manual_dict = nullptr; | 938 const base::DictionaryValue* manual_dict = nullptr; |
938 onc_proxy_settings.GetDictionaryWithoutPathExpansion(::onc::proxy::kManual, | 939 onc_proxy_settings.GetDictionaryWithoutPathExpansion(::onc::proxy::kManual, |
939 &manual_dict); | 940 &manual_dict); |
940 std::string manual_spec; | 941 std::string manual_spec; |
941 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kFtp, &manual_spec); | 942 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kFtp, &manual_spec); |
942 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttp, &manual_spec); | 943 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttp, &manual_spec); |
943 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kSocks, | 944 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kSocks, |
944 &manual_spec); | 945 &manual_spec); |
945 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttps, | 946 AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttps, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 const PrefService* local_state_prefs, | 1319 const PrefService* local_state_prefs, |
1319 const NetworkState& network) { | 1320 const NetworkState& network) { |
1320 ::onc::ONCSource ignored_onc_source; | 1321 ::onc::ONCSource ignored_onc_source; |
1321 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( | 1322 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( |
1322 profile_prefs, local_state_prefs, network, &ignored_onc_source); | 1323 profile_prefs, local_state_prefs, network, &ignored_onc_source); |
1323 return policy != NULL; | 1324 return policy != NULL; |
1324 } | 1325 } |
1325 | 1326 |
1326 } // namespace onc | 1327 } // namespace onc |
1327 } // namespace chromeos | 1328 } // namespace chromeos |
OLD | NEW |