| 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/shill_property_handler.h" | 5 #include "chromeos/network/shill_property_handler.h" |
| 6 | 6 |
| 7 #include <sstream> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| 9 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 12 #include "base/values.h" | 14 #include "base/values.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 #include "chromeos/dbus/shill_device_client.h" | 16 #include "chromeos/dbus/shill_device_client.h" |
| 15 #include "chromeos/dbus/shill_ipconfig_client.h" | 17 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 16 #include "chromeos/dbus/shill_manager_client.h" | 18 #include "chromeos/dbus/shill_manager_client.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // Delete network service observers still in observer_map. | 401 // Delete network service observers still in observer_map. |
| 400 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); | 402 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); |
| 401 iter != observer_map.end(); ++iter) { | 403 iter != observer_map.end(); ++iter) { |
| 402 delete iter->second; | 404 delete iter->second; |
| 403 } | 405 } |
| 404 observer_map.swap(new_observed); | 406 observer_map.swap(new_observed); |
| 405 } | 407 } |
| 406 | 408 |
| 407 void ShillPropertyHandler::UpdateAvailableTechnologies( | 409 void ShillPropertyHandler::UpdateAvailableTechnologies( |
| 408 const base::ListValue& technologies) { | 410 const base::ListValue& technologies) { |
| 411 std::stringstream technologies_str; |
| 412 technologies_str << technologies; |
| 413 NET_LOG_EVENT("AvailableTechnologies:", technologies_str.str()); |
| 409 available_technologies_.clear(); | 414 available_technologies_.clear(); |
| 410 NET_LOG_EVENT("AvailableTechnologiesChanged", | |
| 411 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
| 412 for (base::ListValue::const_iterator iter = technologies.begin(); | 415 for (base::ListValue::const_iterator iter = technologies.begin(); |
| 413 iter != technologies.end(); ++iter) { | 416 iter != technologies.end(); ++iter) { |
| 414 std::string technology; | 417 std::string technology; |
| 415 (*iter)->GetAsString(&technology); | 418 (*iter)->GetAsString(&technology); |
| 416 DCHECK(!technology.empty()); | 419 DCHECK(!technology.empty()); |
| 417 available_technologies_.insert(technology); | 420 available_technologies_.insert(technology); |
| 418 } | 421 } |
| 419 listener_->TechnologyListChanged(); | 422 listener_->TechnologyListChanged(); |
| 420 } | 423 } |
| 421 | 424 |
| 422 void ShillPropertyHandler::UpdateEnabledTechnologies( | 425 void ShillPropertyHandler::UpdateEnabledTechnologies( |
| 423 const base::ListValue& technologies) { | 426 const base::ListValue& technologies) { |
| 427 std::stringstream technologies_str; |
| 428 technologies_str << technologies; |
| 429 NET_LOG_EVENT("EnabledTechnologies:", technologies_str.str()); |
| 424 enabled_technologies_.clear(); | 430 enabled_technologies_.clear(); |
| 425 NET_LOG_EVENT("EnabledTechnologiesChanged", | |
| 426 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
| 427 for (base::ListValue::const_iterator iter = technologies.begin(); | 431 for (base::ListValue::const_iterator iter = technologies.begin(); |
| 428 iter != technologies.end(); ++iter) { | 432 iter != technologies.end(); ++iter) { |
| 429 std::string technology; | 433 std::string technology; |
| 430 (*iter)->GetAsString(&technology); | 434 (*iter)->GetAsString(&technology); |
| 431 DCHECK(!technology.empty()); | 435 DCHECK(!technology.empty()); |
| 432 enabled_technologies_.insert(technology); | 436 enabled_technologies_.insert(technology); |
| 433 enabling_technologies_.erase(technology); | 437 enabling_technologies_.erase(technology); |
| 434 } | 438 } |
| 435 listener_->TechnologyListChanged(); | 439 listener_->TechnologyListChanged(); |
| 436 } | 440 } |
| 437 | 441 |
| 438 void ShillPropertyHandler::UpdateUninitializedTechnologies( | 442 void ShillPropertyHandler::UpdateUninitializedTechnologies( |
| 439 const base::ListValue& technologies) { | 443 const base::ListValue& technologies) { |
| 444 std::stringstream technologies_str; |
| 445 technologies_str << technologies; |
| 446 NET_LOG_EVENT("UninitializedTechnologies:", technologies_str.str()); |
| 440 uninitialized_technologies_.clear(); | 447 uninitialized_technologies_.clear(); |
| 441 NET_LOG_EVENT("UninitializedTechnologiesChanged", | |
| 442 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
| 443 for (base::ListValue::const_iterator iter = technologies.begin(); | 448 for (base::ListValue::const_iterator iter = technologies.begin(); |
| 444 iter != technologies.end(); ++iter) { | 449 iter != technologies.end(); ++iter) { |
| 445 std::string technology; | 450 std::string technology; |
| 446 (*iter)->GetAsString(&technology); | 451 (*iter)->GetAsString(&technology); |
| 447 DCHECK(!technology.empty()); | 452 DCHECK(!technology.empty()); |
| 448 uninitialized_technologies_.insert(technology); | 453 uninitialized_technologies_.insert(technology); |
| 449 } | 454 } |
| 450 listener_->TechnologyListChanged(); | 455 listener_->TechnologyListChanged(); |
| 451 } | 456 } |
| 452 | 457 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 NET_LOG_ERROR("Failed to get IP Config properties", | 579 NET_LOG_ERROR("Failed to get IP Config properties", |
| 575 base::StringPrintf("%s: %d", path.c_str(), call_status)); | 580 base::StringPrintf("%s: %d", path.c_str(), call_status)); |
| 576 return; | 581 return; |
| 577 } | 582 } |
| 578 NET_LOG_EVENT("IP Config properties received", path); | 583 NET_LOG_EVENT("IP Config properties received", path); |
| 579 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); | 584 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); |
| 580 } | 585 } |
| 581 | 586 |
| 582 } // namespace internal | 587 } // namespace internal |
| 583 } // namespace chromeos | 588 } // namespace chromeos |
| OLD | NEW |