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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return nullptr; | 156 return nullptr; |
157 } | 157 } |
158 | 158 |
159 scoped_ptr<base::DictionaryValue> new_root = | 159 scoped_ptr<base::DictionaryValue> new_root = |
160 ReadDictionaryFromJson(plaintext); | 160 ReadDictionaryFromJson(plaintext); |
161 if (!new_root) { | 161 if (!new_root) { |
162 NET_LOG(ERROR) << "Property dictionary malformed."; | 162 NET_LOG(ERROR) << "Property dictionary malformed."; |
163 return nullptr; | 163 return nullptr; |
164 } | 164 } |
165 | 165 |
166 return new_root.Pass(); | 166 return new_root; |
167 } | 167 } |
168 | 168 |
169 std::string GetSourceAsString(ONCSource source) { | 169 std::string GetSourceAsString(ONCSource source) { |
170 switch (source) { | 170 switch (source) { |
171 case ONC_SOURCE_UNKNOWN: | 171 case ONC_SOURCE_UNKNOWN: |
172 return "unknown"; | 172 return "unknown"; |
173 case ONC_SOURCE_NONE: | 173 case ONC_SOURCE_NONE: |
174 return "none"; | 174 return "none"; |
175 case ONC_SOURCE_DEVICE_POLICY: | 175 case ONC_SOURCE_DEVICE_POLICY: |
176 return "device policy"; | 176 return "device policy"; |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 if (onc_proxy_settings.GetListWithoutPathExpansion( | 905 if (onc_proxy_settings.GetListWithoutPathExpansion( |
906 ::onc::proxy::kExcludeDomains, &exclude_domains)) { | 906 ::onc::proxy::kExcludeDomains, &exclude_domains)) { |
907 bypass_rules.AssignFrom( | 907 bypass_rules.AssignFrom( |
908 ConvertOncExcludeDomainsToBypassRules(*exclude_domains)); | 908 ConvertOncExcludeDomainsToBypassRules(*exclude_domains)); |
909 } | 909 } |
910 proxy_dict.reset(ProxyConfigDictionary::CreateFixedServers( | 910 proxy_dict.reset(ProxyConfigDictionary::CreateFixedServers( |
911 manual_spec, bypass_rules.ToString())); | 911 manual_spec, bypass_rules.ToString())); |
912 } else { | 912 } else { |
913 NOTREACHED(); | 913 NOTREACHED(); |
914 } | 914 } |
915 return proxy_dict.Pass(); | 915 return proxy_dict; |
916 } | 916 } |
917 | 917 |
918 scoped_ptr<base::DictionaryValue> ConvertProxyConfigToOncProxySettings( | 918 scoped_ptr<base::DictionaryValue> ConvertProxyConfigToOncProxySettings( |
919 const base::DictionaryValue& proxy_config_value) { | 919 const base::DictionaryValue& proxy_config_value) { |
920 // Create a ProxyConfigDictionary from the DictionaryValue. | 920 // Create a ProxyConfigDictionary from the DictionaryValue. |
921 scoped_ptr<ProxyConfigDictionary> proxy_config( | 921 scoped_ptr<ProxyConfigDictionary> proxy_config( |
922 new ProxyConfigDictionary(&proxy_config_value)); | 922 new ProxyConfigDictionary(&proxy_config_value)); |
923 | 923 |
924 // Create the result DictionaryValue and populate it. | 924 // Create the result DictionaryValue and populate it. |
925 scoped_ptr<base::DictionaryValue> proxy_settings(new base::DictionaryValue); | 925 scoped_ptr<base::DictionaryValue> proxy_settings(new base::DictionaryValue); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 exclude_domains.release()); | 978 exclude_domains.release()); |
979 } | 979 } |
980 } | 980 } |
981 break; | 981 break; |
982 } | 982 } |
983 default: { | 983 default: { |
984 LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; | 984 LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; |
985 return nullptr; | 985 return nullptr; |
986 } | 986 } |
987 } | 987 } |
988 return proxy_settings.Pass(); | 988 return proxy_settings; |
989 } | 989 } |
990 | 990 |
991 } // namespace onc | 991 } // namespace onc |
992 } // namespace chromeos | 992 } // namespace chromeos |
OLD | NEW |