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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // TODO(pneubeck): add a conversion of user configured entries of old | 157 // TODO(pneubeck): add a conversion of user configured entries of old |
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 const NetworkState* network_state = | |
168 network_state_handler_->GetNetworkState(service_path); | |
169 scoped_ptr<base::DictionaryValue> active_settings( | 167 scoped_ptr<base::DictionaryValue> active_settings( |
170 onc::TranslateShillServiceToONCPart(*shill_properties, onc_source, | 168 onc::TranslateShillServiceToONCPart( |
171 &onc::kNetworkWithStateSignature, | 169 *shill_properties, onc_source, &onc::kNetworkWithStateSignature)); |
172 network_state)); | |
173 | 170 |
174 const base::DictionaryValue* network_policy = NULL; | 171 const base::DictionaryValue* network_policy = NULL; |
175 const base::DictionaryValue* global_policy = NULL; | 172 const base::DictionaryValue* global_policy = NULL; |
176 if (profile) { | 173 if (profile) { |
177 const Policies* policies = GetPoliciesForProfile(*profile); | 174 const Policies* policies = GetPoliciesForProfile(*profile); |
178 if (!policies) { | 175 if (!policies) { |
179 InvokeErrorCallback( | 176 InvokeErrorCallback( |
180 service_path, error_callback, kPoliciesNotInitialized); | 177 service_path, error_callback, kPoliciesNotInitialized); |
181 return; | 178 return; |
182 } | 179 } |
(...skipping 26 matching lines...) Expand all Loading... |
209 base::Bind(&ManagedNetworkConfigurationHandlerImpl::SendProperties, | 206 base::Bind(&ManagedNetworkConfigurationHandlerImpl::SendProperties, |
210 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)), | 207 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)), |
211 error_callback); | 208 error_callback); |
212 } | 209 } |
213 | 210 |
214 void ManagedNetworkConfigurationHandlerImpl::SendProperties( | 211 void ManagedNetworkConfigurationHandlerImpl::SendProperties( |
215 const network_handler::DictionaryResultCallback& callback, | 212 const network_handler::DictionaryResultCallback& callback, |
216 const network_handler::ErrorCallback& error_callback, | 213 const network_handler::ErrorCallback& error_callback, |
217 const std::string& service_path, | 214 const std::string& service_path, |
218 scoped_ptr<base::DictionaryValue> shill_properties) { | 215 scoped_ptr<base::DictionaryValue> shill_properties) { |
219 const NetworkState* network_state = | |
220 network_state_handler_->GetNetworkState(service_path); | |
221 scoped_ptr<base::DictionaryValue> onc_network( | 216 scoped_ptr<base::DictionaryValue> onc_network( |
222 onc::TranslateShillServiceToONCPart( | 217 onc::TranslateShillServiceToONCPart( |
223 *shill_properties, ::onc::ONC_SOURCE_UNKNOWN, | 218 *shill_properties, ::onc::ONC_SOURCE_UNKNOWN, |
224 &onc::kNetworkWithStateSignature, network_state)); | 219 &onc::kNetworkWithStateSignature)); |
225 callback.Run(service_path, *onc_network); | 220 callback.Run(service_path, *onc_network); |
226 } | 221 } |
227 | 222 |
228 // SetProperties | 223 // SetProperties |
229 | 224 |
230 void ManagedNetworkConfigurationHandlerImpl::SetProperties( | 225 void ManagedNetworkConfigurationHandlerImpl::SetProperties( |
231 const std::string& service_path, | 226 const std::string& service_path, |
232 const base::DictionaryValue& user_settings, | 227 const base::DictionaryValue& user_settings, |
233 const base::Closure& callback, | 228 const base::Closure& callback, |
234 const network_handler::ErrorCallback& error_callback) { | 229 const network_handler::ErrorCallback& error_callback) { |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 scoped_ptr<base::DictionaryValue> network_properties, | 828 scoped_ptr<base::DictionaryValue> network_properties, |
834 GetDevicePropertiesCallback send_callback, | 829 GetDevicePropertiesCallback send_callback, |
835 const std::string& error_name, | 830 const std::string& error_name, |
836 scoped_ptr<base::DictionaryValue> error_data) { | 831 scoped_ptr<base::DictionaryValue> error_data) { |
837 NET_LOG_ERROR("Error getting device properties", service_path); | 832 NET_LOG_ERROR("Error getting device properties", service_path); |
838 send_callback.Run(service_path, network_properties.Pass()); | 833 send_callback.Run(service_path, network_properties.Pass()); |
839 } | 834 } |
840 | 835 |
841 | 836 |
842 } // namespace chromeos | 837 } // namespace chromeos |
OLD | NEW |