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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // Delete network service observers still in observer_map. | 407 // Delete network service observers still in observer_map. |
406 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); | 408 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); |
407 iter != observer_map.end(); ++iter) { | 409 iter != observer_map.end(); ++iter) { |
408 delete iter->second; | 410 delete iter->second; |
409 } | 411 } |
410 observer_map.swap(new_observed); | 412 observer_map.swap(new_observed); |
411 } | 413 } |
412 | 414 |
413 void ShillPropertyHandler::UpdateAvailableTechnologies( | 415 void ShillPropertyHandler::UpdateAvailableTechnologies( |
414 const base::ListValue& technologies) { | 416 const base::ListValue& technologies) { |
| 417 std::stringstream technologies_str; |
| 418 technologies_str << technologies; |
| 419 NET_LOG_EVENT("AvailableTechnologies:", technologies_str.str()); |
415 available_technologies_.clear(); | 420 available_technologies_.clear(); |
416 NET_LOG_EVENT("AvailableTechnologiesChanged", | |
417 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
418 for (base::ListValue::const_iterator iter = technologies.begin(); | 421 for (base::ListValue::const_iterator iter = technologies.begin(); |
419 iter != technologies.end(); ++iter) { | 422 iter != technologies.end(); ++iter) { |
420 std::string technology; | 423 std::string technology; |
421 (*iter)->GetAsString(&technology); | 424 (*iter)->GetAsString(&technology); |
422 DCHECK(!technology.empty()); | 425 DCHECK(!technology.empty()); |
423 available_technologies_.insert(technology); | 426 available_technologies_.insert(technology); |
424 } | 427 } |
425 listener_->TechnologyListChanged(); | 428 listener_->TechnologyListChanged(); |
426 } | 429 } |
427 | 430 |
428 void ShillPropertyHandler::UpdateEnabledTechnologies( | 431 void ShillPropertyHandler::UpdateEnabledTechnologies( |
429 const base::ListValue& technologies) { | 432 const base::ListValue& technologies) { |
| 433 std::stringstream technologies_str; |
| 434 technologies_str << technologies; |
| 435 NET_LOG_EVENT("EnabledTechnologies:", technologies_str.str()); |
430 enabled_technologies_.clear(); | 436 enabled_technologies_.clear(); |
431 NET_LOG_EVENT("EnabledTechnologiesChanged", | |
432 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
433 for (base::ListValue::const_iterator iter = technologies.begin(); | 437 for (base::ListValue::const_iterator iter = technologies.begin(); |
434 iter != technologies.end(); ++iter) { | 438 iter != technologies.end(); ++iter) { |
435 std::string technology; | 439 std::string technology; |
436 (*iter)->GetAsString(&technology); | 440 (*iter)->GetAsString(&technology); |
437 DCHECK(!technology.empty()); | 441 DCHECK(!technology.empty()); |
438 enabled_technologies_.insert(technology); | 442 enabled_technologies_.insert(technology); |
439 enabling_technologies_.erase(technology); | 443 enabling_technologies_.erase(technology); |
440 } | 444 } |
441 listener_->TechnologyListChanged(); | 445 listener_->TechnologyListChanged(); |
442 } | 446 } |
443 | 447 |
444 void ShillPropertyHandler::UpdateUninitializedTechnologies( | 448 void ShillPropertyHandler::UpdateUninitializedTechnologies( |
445 const base::ListValue& technologies) { | 449 const base::ListValue& technologies) { |
| 450 std::stringstream technologies_str; |
| 451 technologies_str << technologies; |
| 452 NET_LOG_EVENT("UninitializedTechnologies:", technologies_str.str()); |
446 uninitialized_technologies_.clear(); | 453 uninitialized_technologies_.clear(); |
447 NET_LOG_EVENT("UninitializedTechnologiesChanged", | |
448 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | |
449 for (base::ListValue::const_iterator iter = technologies.begin(); | 454 for (base::ListValue::const_iterator iter = technologies.begin(); |
450 iter != technologies.end(); ++iter) { | 455 iter != technologies.end(); ++iter) { |
451 std::string technology; | 456 std::string technology; |
452 (*iter)->GetAsString(&technology); | 457 (*iter)->GetAsString(&technology); |
453 DCHECK(!technology.empty()); | 458 DCHECK(!technology.empty()); |
454 uninitialized_technologies_.insert(technology); | 459 uninitialized_technologies_.insert(technology); |
455 } | 460 } |
456 listener_->TechnologyListChanged(); | 461 listener_->TechnologyListChanged(); |
457 } | 462 } |
458 | 463 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 NET_LOG_ERROR("Failed to get IP Config properties", | 582 NET_LOG_ERROR("Failed to get IP Config properties", |
578 base::StringPrintf("%s: %d", path.c_str(), call_status)); | 583 base::StringPrintf("%s: %d", path.c_str(), call_status)); |
579 return; | 584 return; |
580 } | 585 } |
581 NET_LOG_EVENT("IP Config properties received", path); | 586 NET_LOG_EVENT("IP Config properties received", path); |
582 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); | 587 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); |
583 } | 588 } |
584 | 589 |
585 } // namespace internal | 590 } // namespace internal |
586 } // namespace chromeos | 591 } // namespace chromeos |
OLD | NEW |