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