diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 00:52:21 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 00:52:21 +0000 |
commit | 9c264eb2d1f366bac9f15d43bd9e35aee47a6ba6 (patch) | |
tree | 02e968f5bcdc81e04eccf3f8b3d8422f85979abc /chromeos/network | |
parent | fc31d3070e929451e0bf37c8698e13c07da9d9cd (diff) | |
download | chromium_src-9c264eb2d1f366bac9f15d43bd9e35aee47a6ba6.zip chromium_src-9c264eb2d1f366bac9f15d43bd9e35aee47a6ba6.tar.gz chromium_src-9c264eb2d1f366bac9f15d43bd9e35aee47a6ba6.tar.bz2 |
Move IPConfig request down to ShillPropertyHandler
This is just a bit of cleanup I did while working in data plans support.
BUG=none
Review URL: https://chromiumcodereview.appspot.com/11417128
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/network')
-rw-r--r-- | chromeos/network/network_state_handler.cc | 27 | ||||
-rw-r--r-- | chromeos/network/shill_property_handler.cc | 26 | ||||
-rw-r--r-- | chromeos/network/shill_property_handler.h | 5 |
3 files changed, 22 insertions, 36 deletions
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc index 8b4ff3c..c898446 100644 --- a/chromeos/network/network_state_handler.cc +++ b/chromeos/network/network_state_handler.cc @@ -421,27 +421,14 @@ bool NetworkStateHandler::ParseNetworkServiceProperty( const std::string& key, const base::Value& value) { DCHECK(network); - bool property_changed = false; - if (key == shill::kIPConfigProperty) { - // Handle IPConfig here instead of in NetworkState::PropertyChanged since - // we need to call into shill_property_handler_ to fetch them. This will - // trigger a call to UpdateNetworkServiceIPAddress(), which will notify - // any observers. - std::string ip_config_path; - value.GetAsString(&ip_config_path); - DCHECK(!ip_config_path.empty()); - shill_property_handler_->RequestIPConfig(network->path(), ip_config_path); - } else { - if (network->PropertyChanged(key, value)) { - property_changed = true; - if (network->path() == active_network_path_ && - key == flimflam::kStateProperty) { - FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, - ActiveNetworkStateChanged(network)); - } - } + if (!network->PropertyChanged(key, value)) + return false; + if (network->path() == active_network_path_ && + key == flimflam::kStateProperty) { + FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, + ActiveNetworkStateChanged(network)); } - return property_changed; + return true; } } // namespace chromeos diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc index ec9331b..e905089 100644 --- a/chromeos/network/shill_property_handler.cc +++ b/chromeos/network/shill_property_handler.cc @@ -109,16 +109,6 @@ void ShillPropertyHandler::RequestProperties(ManagedState::ManagedType type, } } -void ShillPropertyHandler::RequestIPConfig( - const std::string& service_path, - const std::string& ip_config_path) { - DBusThreadManager::Get()->GetShillIPConfigClient()->GetProperties( - dbus::ObjectPath(ip_config_path), - base::Bind(&ShillPropertyHandler::GetIPConfigCallback, - weak_ptr_factory_.GetWeakPtr(), - service_path)); -} - void ShillPropertyHandler::OnPropertyChanged(const std::string& key, const base::Value& value) { if (ManagerPropertyChanged(key, value)) @@ -212,7 +202,7 @@ void ShillPropertyHandler::UpdateObservedNetworkServices( continue; ShillServiceObserverMap::iterator iter2 = observed_networks_.find(path); if (iter2 != observed_networks_.end()) { - new_observed[path] = observed_networks_[path]; + new_observed[path] = iter2->second; } else { new_observed[path] = new ShillServiceObserver( path, base::Bind( @@ -261,7 +251,19 @@ void ShillPropertyHandler::NetworkServicePropertyChangedCallback( const std::string& path, const std::string& key, const base::Value& value) { - listener_->UpdateNetworkServiceProperty(path, key, value); + if (key == shill::kIPConfigProperty) { + // Handle IPConfig here and call listener_->UpdateNetworkServiceIPAddress + // when the request completes. + std::string ip_config_path; + value.GetAsString(&ip_config_path); + DCHECK(!ip_config_path.empty()); + DBusThreadManager::Get()->GetShillIPConfigClient()->GetProperties( + dbus::ObjectPath(ip_config_path), + base::Bind(&ShillPropertyHandler::GetIPConfigCallback, + weak_ptr_factory_.GetWeakPtr(), path)); + } else { + listener_->UpdateNetworkServiceProperty(path, key, value); + } } void ShillPropertyHandler::GetIPConfigCallback( diff --git a/chromeos/network/shill_property_handler.h b/chromeos/network/shill_property_handler.h index 0bb6e6b..63d2337 100644 --- a/chromeos/network/shill_property_handler.h +++ b/chromeos/network/shill_property_handler.h @@ -107,10 +107,7 @@ class CHROMEOS_EXPORT ShillPropertyHandler void RequestProperties(ManagedState::ManagedType type, const std::string& path); - // Requests the IP config specified by |ip_config_path| for |service_path|. - void RequestIPConfig(const std::string& service_path, - const std::string& ip_config_path); - + // Returns true if |service_path| is being observed. bool IsObservingNetwork(const std::string& service_path) { return observed_networks_.count(service_path) != 0; } |