| 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_state_handler.h" | 5 #include "chromeos/network/network_state_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 if (!device) | 604 if (!device) |
| 605 return; | 605 return; |
| 606 if (!device->PropertyChanged(key, value)) | 606 if (!device->PropertyChanged(key, value)) |
| 607 return; | 607 return; |
| 608 | 608 |
| 609 std::string detail = device->name() + "." + key; | 609 std::string detail = device->name() + "." + key; |
| 610 detail += " = " + network_event_log::ValueAsString(value); | 610 detail += " = " + network_event_log::ValueAsString(value); |
| 611 NET_LOG_EVENT("DevicePropertyUpdated", detail); | 611 NET_LOG_EVENT("DevicePropertyUpdated", detail); |
| 612 | 612 |
| 613 NotifyDeviceListChanged(); | 613 NotifyDeviceListChanged(); |
| 614 NotifyDevicePropertiesUpdated(device); |
| 614 | 615 |
| 615 if (key == shill::kScanningProperty && device->scanning() == false) | 616 if (key == shill::kScanningProperty && device->scanning() == false) |
| 616 ScanCompleted(device->type()); | 617 ScanCompleted(device->type()); |
| 617 if (key == shill::kEapAuthenticationCompletedProperty) { | 618 if (key == shill::kEapAuthenticationCompletedProperty) { |
| 618 // Notify a change for each Ethernet service using this device. | 619 // Notify a change for each Ethernet service using this device. |
| 619 NetworkStateList ethernet_services; | 620 NetworkStateList ethernet_services; |
| 620 GetNetworkListByType(NetworkTypePattern::Ethernet(), | 621 GetNetworkListByType(NetworkTypePattern::Ethernet(), |
| 621 false /* configured_only */, | 622 false /* configured_only */, |
| 622 false /* visible_only */, | 623 false /* visible_only */, |
| 623 0 /* no limit */, | 624 0 /* no limit */, |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 DefaultNetworkChanged(default_network)); | 891 DefaultNetworkChanged(default_network)); |
| 891 } | 892 } |
| 892 | 893 |
| 893 void NetworkStateHandler::NotifyNetworkPropertiesUpdated( | 894 void NetworkStateHandler::NotifyNetworkPropertiesUpdated( |
| 894 const NetworkState* network) { | 895 const NetworkState* network) { |
| 895 NET_LOG_DEBUG("NOTIFY:NetworkPropertiesUpdated", GetLogName(network)); | 896 NET_LOG_DEBUG("NOTIFY:NetworkPropertiesUpdated", GetLogName(network)); |
| 896 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, | 897 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, |
| 897 NetworkPropertiesUpdated(network)); | 898 NetworkPropertiesUpdated(network)); |
| 898 } | 899 } |
| 899 | 900 |
| 901 void NetworkStateHandler::NotifyDevicePropertiesUpdated( |
| 902 const DeviceState* device) { |
| 903 NET_LOG_DEBUG("NOTIFY:DevicePropertiesUpdated", GetLogName(device)); |
| 904 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, |
| 905 DevicePropertiesUpdated(device)); |
| 906 } |
| 907 |
| 900 void NetworkStateHandler::ScanCompleted(const std::string& type) { | 908 void NetworkStateHandler::ScanCompleted(const std::string& type) { |
| 901 size_t num_callbacks = scan_complete_callbacks_.count(type); | 909 size_t num_callbacks = scan_complete_callbacks_.count(type); |
| 902 NET_LOG_EVENT("ScanCompleted", | 910 NET_LOG_EVENT("ScanCompleted", |
| 903 base::StringPrintf("%s:%" PRIuS, type.c_str(), num_callbacks)); | 911 base::StringPrintf("%s:%" PRIuS, type.c_str(), num_callbacks)); |
| 904 if (num_callbacks == 0) | 912 if (num_callbacks == 0) |
| 905 return; | 913 return; |
| 906 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; | 914 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; |
| 907 for (ScanCallbackList::iterator iter = callback_list.begin(); | 915 for (ScanCallbackList::iterator iter = callback_list.begin(); |
| 908 iter != callback_list.end(); ++iter) { | 916 iter != callback_list.end(); ++iter) { |
| 909 (*iter).Run(); | 917 (*iter).Run(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 if (type.MatchesType(shill::kTypeBluetooth)) | 957 if (type.MatchesType(shill::kTypeBluetooth)) |
| 950 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 958 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
| 951 if (type.MatchesType(shill::kTypeVPN)) | 959 if (type.MatchesType(shill::kTypeVPN)) |
| 952 technologies.push_back(new std::string(shill::kTypeVPN)); | 960 technologies.push_back(new std::string(shill::kTypeVPN)); |
| 953 | 961 |
| 954 CHECK_GT(technologies.size(), 0ul); | 962 CHECK_GT(technologies.size(), 0ul); |
| 955 return technologies.Pass(); | 963 return technologies.Pass(); |
| 956 } | 964 } |
| 957 | 965 |
| 958 } // namespace chromeos | 966 } // namespace chromeos |
| OLD | NEW |