OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/managed_network_configuration_handler_impl.h" | 5 #include "chromeos/network/managed_network_configuration_handler_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // ChromeOS versions. We will have to use a heuristic to determine which | 158 // ChromeOS versions. We will have to use a heuristic to determine which |
159 // properties _might_ be user configured. | 159 // properties _might_ be user configured. |
160 } | 160 } |
161 | 161 |
162 std::string guid; | 162 std::string guid; |
163 shill_properties->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); | 163 shill_properties->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); |
164 | 164 |
165 ::onc::ONCSource onc_source; | 165 ::onc::ONCSource onc_source; |
166 FindPolicyByGUID(userhash, guid, &onc_source); | 166 FindPolicyByGUID(userhash, guid, &onc_source); |
167 scoped_ptr<base::DictionaryValue> active_settings( | 167 scoped_ptr<base::DictionaryValue> active_settings( |
168 onc::TranslateShillServiceToONCPart( | 168 network_util::TranslateShillPropertiesToONC( |
169 *shill_properties, onc_source, &onc::kNetworkWithStateSignature)); | 169 service_path, *shill_properties, onc_source)); |
170 | 170 |
171 const base::DictionaryValue* network_policy = NULL; | 171 const base::DictionaryValue* network_policy = NULL; |
172 const base::DictionaryValue* global_policy = NULL; | 172 const base::DictionaryValue* global_policy = NULL; |
173 if (profile) { | 173 if (profile) { |
174 const Policies* policies = GetPoliciesForProfile(*profile); | 174 const Policies* policies = GetPoliciesForProfile(*profile); |
175 if (!policies) { | 175 if (!policies) { |
176 InvokeErrorCallback( | 176 InvokeErrorCallback( |
177 service_path, error_callback, kPoliciesNotInitialized); | 177 service_path, error_callback, kPoliciesNotInitialized); |
178 return; | 178 return; |
179 } | 179 } |
(...skipping 27 matching lines...) Expand all Loading... |
207 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)), | 207 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)), |
208 error_callback); | 208 error_callback); |
209 } | 209 } |
210 | 210 |
211 void ManagedNetworkConfigurationHandlerImpl::SendProperties( | 211 void ManagedNetworkConfigurationHandlerImpl::SendProperties( |
212 const network_handler::DictionaryResultCallback& callback, | 212 const network_handler::DictionaryResultCallback& callback, |
213 const network_handler::ErrorCallback& error_callback, | 213 const network_handler::ErrorCallback& error_callback, |
214 const std::string& service_path, | 214 const std::string& service_path, |
215 scoped_ptr<base::DictionaryValue> shill_properties) { | 215 scoped_ptr<base::DictionaryValue> shill_properties) { |
216 scoped_ptr<base::DictionaryValue> onc_network( | 216 scoped_ptr<base::DictionaryValue> onc_network( |
217 onc::TranslateShillServiceToONCPart( | 217 network_util::TranslateShillPropertiesToONC( |
218 *shill_properties, ::onc::ONC_SOURCE_UNKNOWN, | 218 service_path, *shill_properties, ::onc::ONC_SOURCE_UNKNOWN)); |
219 &onc::kNetworkWithStateSignature)); | |
220 callback.Run(service_path, *onc_network); | 219 callback.Run(service_path, *onc_network); |
221 } | 220 } |
222 | 221 |
223 // SetProperties | 222 // SetProperties |
224 | 223 |
225 void ManagedNetworkConfigurationHandlerImpl::SetProperties( | 224 void ManagedNetworkConfigurationHandlerImpl::SetProperties( |
226 const std::string& service_path, | 225 const std::string& service_path, |
227 const base::DictionaryValue& user_settings, | 226 const base::DictionaryValue& user_settings, |
228 const base::Closure& callback, | 227 const base::Closure& callback, |
229 const network_handler::ErrorCallback& error_callback) { | 228 const network_handler::ErrorCallback& error_callback) { |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 scoped_ptr<base::DictionaryValue> network_properties, | 827 scoped_ptr<base::DictionaryValue> network_properties, |
829 GetDevicePropertiesCallback send_callback, | 828 GetDevicePropertiesCallback send_callback, |
830 const std::string& error_name, | 829 const std::string& error_name, |
831 scoped_ptr<base::DictionaryValue> error_data) { | 830 scoped_ptr<base::DictionaryValue> error_data) { |
832 NET_LOG_ERROR("Error getting device properties", service_path); | 831 NET_LOG_ERROR("Error getting device properties", service_path); |
833 send_callback.Run(service_path, network_properties.Pass()); | 832 send_callback.Run(service_path, network_properties.Pass()); |
834 } | 833 } |
835 | 834 |
836 | 835 |
837 } // namespace chromeos | 836 } // namespace chromeos |
OLD | NEW |