Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Side by Side Diff: chromeos/network/network_state_handler.cc

Issue 395523004: Add DevicePropertiesUpdated to NetworkStateHandlerObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for IPconfig(s) and add test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 21 matching lines...) Expand all
645 return; 646 return;
646 network->IPConfigPropertiesChanged(properties); 647 network->IPConfigPropertiesChanged(properties);
647 NotifyNetworkPropertiesUpdated(network); 648 NotifyNetworkPropertiesUpdated(network);
648 if (network->path() == default_network_path_) 649 if (network->path() == default_network_path_)
649 NotifyDefaultNetworkChanged(network); 650 NotifyDefaultNetworkChanged(network);
650 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { 651 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) {
651 DeviceState* device = GetModifiableDeviceState(path); 652 DeviceState* device = GetModifiableDeviceState(path);
652 if (!device) 653 if (!device)
653 return; 654 return;
654 device->IPConfigPropertiesChanged(ip_config_path, properties); 655 device->IPConfigPropertiesChanged(ip_config_path, properties);
656 NotifyDevicePropertiesUpdated(device);
655 if (!default_network_path_.empty()) { 657 if (!default_network_path_.empty()) {
656 const NetworkState* default_network = 658 const NetworkState* default_network =
657 GetNetworkState(default_network_path_); 659 GetNetworkState(default_network_path_);
658 if (default_network && default_network->device_path() == path) 660 if (default_network && default_network->device_path() == path)
659 NotifyDefaultNetworkChanged(default_network); 661 NotifyDefaultNetworkChanged(default_network);
660 } 662 }
661 } 663 }
662 } 664 }
663 665
664 void NetworkStateHandler::CheckPortalListChanged( 666 void NetworkStateHandler::CheckPortalListChanged(
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 DefaultNetworkChanged(default_network)); 892 DefaultNetworkChanged(default_network));
891 } 893 }
892 894
893 void NetworkStateHandler::NotifyNetworkPropertiesUpdated( 895 void NetworkStateHandler::NotifyNetworkPropertiesUpdated(
894 const NetworkState* network) { 896 const NetworkState* network) {
895 NET_LOG_DEBUG("NOTIFY:NetworkPropertiesUpdated", GetLogName(network)); 897 NET_LOG_DEBUG("NOTIFY:NetworkPropertiesUpdated", GetLogName(network));
896 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, 898 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
897 NetworkPropertiesUpdated(network)); 899 NetworkPropertiesUpdated(network));
898 } 900 }
899 901
902 void NetworkStateHandler::NotifyDevicePropertiesUpdated(
903 const DeviceState* device) {
904 NET_LOG_DEBUG("NOTIFY:DevicePropertiesUpdated", GetLogName(device));
905 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
906 DevicePropertiesUpdated(device));
907 }
908
900 void NetworkStateHandler::ScanCompleted(const std::string& type) { 909 void NetworkStateHandler::ScanCompleted(const std::string& type) {
901 size_t num_callbacks = scan_complete_callbacks_.count(type); 910 size_t num_callbacks = scan_complete_callbacks_.count(type);
902 NET_LOG_EVENT("ScanCompleted", 911 NET_LOG_EVENT("ScanCompleted",
903 base::StringPrintf("%s:%" PRIuS, type.c_str(), num_callbacks)); 912 base::StringPrintf("%s:%" PRIuS, type.c_str(), num_callbacks));
904 if (num_callbacks == 0) 913 if (num_callbacks == 0)
905 return; 914 return;
906 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; 915 ScanCallbackList& callback_list = scan_complete_callbacks_[type];
907 for (ScanCallbackList::iterator iter = callback_list.begin(); 916 for (ScanCallbackList::iterator iter = callback_list.begin();
908 iter != callback_list.end(); ++iter) { 917 iter != callback_list.end(); ++iter) {
909 (*iter).Run(); 918 (*iter).Run();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 if (type.MatchesType(shill::kTypeBluetooth)) 958 if (type.MatchesType(shill::kTypeBluetooth))
950 technologies.push_back(new std::string(shill::kTypeBluetooth)); 959 technologies.push_back(new std::string(shill::kTypeBluetooth));
951 if (type.MatchesType(shill::kTypeVPN)) 960 if (type.MatchesType(shill::kTypeVPN))
952 technologies.push_back(new std::string(shill::kTypeVPN)); 961 technologies.push_back(new std::string(shill::kTypeVPN));
953 962
954 CHECK_GT(technologies.size(), 0ul); 963 CHECK_GT(technologies.size(), 0ul);
955 return technologies.Pass(); 964 return technologies.Pass();
956 } 965 }
957 966
958 } // namespace chromeos 967 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698