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 <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chromeos/dbus/shill_manager_client.h" | 18 #include "chromeos/dbus/shill_manager_client.h" |
19 #include "chromeos/dbus/shill_profile_client.h" | 19 #include "chromeos/dbus/shill_profile_client.h" |
20 #include "chromeos/dbus/shill_service_client.h" | 20 #include "chromeos/dbus/shill_service_client.h" |
21 #include "chromeos/network/device_state.h" | 21 #include "chromeos/network/device_state.h" |
22 #include "chromeos/network/favorite_state.h" | |
22 #include "chromeos/network/network_configuration_handler.h" | 23 #include "chromeos/network/network_configuration_handler.h" |
23 #include "chromeos/network/network_event_log.h" | 24 #include "chromeos/network/network_event_log.h" |
24 #include "chromeos/network/network_policy_observer.h" | 25 #include "chromeos/network/network_policy_observer.h" |
25 #include "chromeos/network/network_profile.h" | 26 #include "chromeos/network/network_profile.h" |
26 #include "chromeos/network/network_profile_handler.h" | 27 #include "chromeos/network/network_profile_handler.h" |
27 #include "chromeos/network/network_state.h" | 28 #include "chromeos/network/network_state.h" |
28 #include "chromeos/network/network_state_handler.h" | 29 #include "chromeos/network/network_state_handler.h" |
29 #include "chromeos/network/network_ui_data.h" | 30 #include "chromeos/network/network_ui_data.h" |
30 #include "chromeos/network/onc/onc_merger.h" | 31 #include "chromeos/network/onc/onc_merger.h" |
31 #include "chromeos/network/onc/onc_signature.h" | 32 #include "chromeos/network/onc/onc_signature.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 *properties_copy, | 231 *properties_copy, |
231 &onc::kNetworkWithStateSignature)); | 232 &onc::kNetworkWithStateSignature)); |
232 callback.Run(service_path, *onc_network); | 233 callback.Run(service_path, *onc_network); |
233 } | 234 } |
234 | 235 |
235 void ManagedNetworkConfigurationHandlerImpl::SetProperties( | 236 void ManagedNetworkConfigurationHandlerImpl::SetProperties( |
236 const std::string& service_path, | 237 const std::string& service_path, |
237 const base::DictionaryValue& user_settings, | 238 const base::DictionaryValue& user_settings, |
238 const base::Closure& callback, | 239 const base::Closure& callback, |
239 const network_handler::ErrorCallback& error_callback) const { | 240 const network_handler::ErrorCallback& error_callback) const { |
240 const NetworkState* state = | 241 const FavoriteState* state = |
241 network_state_handler_->GetNetworkState(service_path); | 242 network_state_handler_->GetFavoriteState(service_path); |
242 | 243 |
243 if (!state) { | 244 if (!state) { |
244 InvokeErrorCallback(service_path, error_callback, kUnknownServicePath); | 245 InvokeErrorCallback(service_path, error_callback, kUnknownServicePath); |
pneubeck (no reviews)
2014/05/12 13:37:07
nit: the error is not fully correct anymore. more
stevenjb
2014/05/13 01:19:00
-> 'UnknownNetwork'
| |
245 return; | 246 return; |
246 } | 247 } |
247 | 248 |
248 std::string guid = state->guid(); | 249 std::string guid = state->guid(); |
249 if (guid.empty()) { | 250 if (guid.empty()) { |
250 // TODO(pneubeck): create an initial configuration in this case. As for | 251 // TODO(pneubeck): create an initial configuration in this case. As for |
251 // CreateConfiguration, user settings from older ChromeOS versions have to | 252 // CreateConfiguration, user settings from older ChromeOS versions have to |
252 // determined here. | 253 // determined here. |
253 InvokeErrorCallback( | 254 InvokeErrorCallback( |
254 service_path, error_callback, kSetOnUnconfiguredNetwork); | 255 service_path, error_callback, kSetOnUnconfiguredNetwork); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 // Convert IPConfig dictionary to a ListValue. | 634 // Convert IPConfig dictionary to a ListValue. |
634 base::ListValue* ip_configs = new base::ListValue; | 635 base::ListValue* ip_configs = new base::ListValue; |
635 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); | 636 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); |
636 !iter.IsAtEnd(); iter.Advance()) { | 637 !iter.IsAtEnd(); iter.Advance()) { |
637 ip_configs->Append(iter.value().DeepCopy()); | 638 ip_configs->Append(iter.value().DeepCopy()); |
638 } | 639 } |
639 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, ip_configs); | 640 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, ip_configs); |
640 } | 641 } |
641 | 642 |
642 } // namespace chromeos | 643 } // namespace chromeos |
OLD | NEW |