| 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/network_configuration_handler.h" | 5 #include "chromeos/network/network_configuration_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 dbus::ObjectPath(service_path), names, | 272 dbus::ObjectPath(service_path), names, |
| 273 base::Bind(&NetworkConfigurationHandler::ClearPropertiesSuccessCallback, | 273 base::Bind(&NetworkConfigurationHandler::ClearPropertiesSuccessCallback, |
| 274 AsWeakPtr(), service_path, names, callback), | 274 AsWeakPtr(), service_path, names, callback), |
| 275 base::Bind(&NetworkConfigurationHandler::ClearPropertiesErrorCallback, | 275 base::Bind(&NetworkConfigurationHandler::ClearPropertiesErrorCallback, |
| 276 AsWeakPtr(), service_path, error_callback)); | 276 AsWeakPtr(), service_path, error_callback)); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void NetworkConfigurationHandler::CreateShillConfiguration( | 279 void NetworkConfigurationHandler::CreateShillConfiguration( |
| 280 const base::DictionaryValue& shill_properties, | 280 const base::DictionaryValue& shill_properties, |
| 281 NetworkConfigurationObserver::Source source, | 281 NetworkConfigurationObserver::Source source, |
| 282 const network_handler::StringResultCallback& callback, | 282 const network_handler::ServiceResultCallback& callback, |
| 283 const network_handler::ErrorCallback& error_callback) { | 283 const network_handler::ErrorCallback& error_callback) { |
| 284 ShillManagerClient* manager = | 284 ShillManagerClient* manager = |
| 285 DBusThreadManager::Get()->GetShillManagerClient(); | 285 DBusThreadManager::Get()->GetShillManagerClient(); |
| 286 std::string type; | 286 std::string type; |
| 287 shill_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); | 287 shill_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
| 288 DCHECK(!type.empty()); | 288 DCHECK(!type.empty()); |
| 289 | 289 |
| 290 std::string network_id = | 290 std::string network_id = |
| 291 shill_property_util::GetNetworkIdFromProperties(shill_properties); | 291 shill_property_util::GetNetworkIdFromProperties(shill_properties); |
| 292 | 292 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 NetworkStateHandler* network_state_handler, | 386 NetworkStateHandler* network_state_handler, |
| 387 NetworkDeviceHandler* network_device_handler) { | 387 NetworkDeviceHandler* network_device_handler) { |
| 388 network_state_handler_ = network_state_handler; | 388 network_state_handler_ = network_state_handler; |
| 389 network_device_handler_ = network_device_handler; | 389 network_device_handler_ = network_device_handler; |
| 390 } | 390 } |
| 391 | 391 |
| 392 void NetworkConfigurationHandler::RunCreateNetworkCallback( | 392 void NetworkConfigurationHandler::RunCreateNetworkCallback( |
| 393 const std::string& profile_path, | 393 const std::string& profile_path, |
| 394 NetworkConfigurationObserver::Source source, | 394 NetworkConfigurationObserver::Source source, |
| 395 scoped_ptr<base::DictionaryValue> configure_properties, | 395 scoped_ptr<base::DictionaryValue> configure_properties, |
| 396 const network_handler::StringResultCallback& callback, | 396 const network_handler::ServiceResultCallback& callback, |
| 397 const dbus::ObjectPath& service_path) { | 397 const dbus::ObjectPath& service_path) { |
| 398 if (!callback.is_null()) | 398 if (!callback.is_null()) { |
| 399 callback.Run(service_path.value()); | 399 std::string guid; |
| 400 configure_properties->GetStringWithoutPathExpansion( |
| 401 ::onc::network_config::kGUID, &guid); |
| 402 DCHECK(!guid.empty()); |
| 403 callback.Run(service_path.value(), guid); |
| 404 } |
| 400 FOR_EACH_OBSERVER(NetworkConfigurationObserver, observers_, | 405 FOR_EACH_OBSERVER(NetworkConfigurationObserver, observers_, |
| 401 OnConfigurationCreated(service_path.value(), profile_path, | 406 OnConfigurationCreated(service_path.value(), profile_path, |
| 402 *configure_properties, source)); | 407 *configure_properties, source)); |
| 403 // This may also get called when CreateConfiguration is used to update an | 408 // This may also get called when CreateConfiguration is used to update an |
| 404 // existing configuration, so request a service update just in case. | 409 // existing configuration, so request a service update just in case. |
| 405 // TODO(pneubeck): Separate 'Create' and 'Update' calls and only trigger | 410 // TODO(pneubeck): Separate 'Create' and 'Update' calls and only trigger |
| 406 // this on an update. | 411 // this on an update. |
| 407 network_state_handler_->RequestUpdateForNetwork(service_path.value()); | 412 network_state_handler_->RequestUpdateForNetwork(service_path.value()); |
| 408 } | 413 } |
| 409 | 414 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // static | 562 // static |
| 558 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( | 563 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( |
| 559 NetworkStateHandler* network_state_handler, | 564 NetworkStateHandler* network_state_handler, |
| 560 NetworkDeviceHandler* network_device_handler) { | 565 NetworkDeviceHandler* network_device_handler) { |
| 561 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); | 566 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); |
| 562 handler->Init(network_state_handler, network_device_handler); | 567 handler->Init(network_state_handler, network_device_handler); |
| 563 return handler; | 568 return handler; |
| 564 } | 569 } |
| 565 | 570 |
| 566 } // namespace chromeos | 571 } // namespace chromeos |
| OLD | NEW |