diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 04:07:05 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 04:07:05 +0000 |
commit | 3c34dd58e21ea33424c635afaf22c82476f56afb (patch) | |
tree | ef57c251ae5f3cef33365659a6e9aa1535fc5a32 /chromeos/dbus/shill_ipconfig_client.cc | |
parent | 2bab166de6e6cdcbd9168a138a5dca1f266d14c3 (diff) | |
download | chromium_src-3c34dd58e21ea33424c635afaf22c82476f56afb.zip chromium_src-3c34dd58e21ea33424c635afaf22c82476f56afb.tar.gz chromium_src-3c34dd58e21ea33424c635afaf22c82476f56afb.tar.bz2 |
This converts the Shill clients to use an observer pattern
for property change notifications because in a future CL the
javascript private API will need to listen directly to shill
notifications as well, and the previous implementation was limited to
a single handler.
BUG=chromium:147620,chromium:146616
TEST=Ran unit tests, ran on device.
Review URL: https://chromiumcodereview.appspot.com/10965045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/shill_ipconfig_client.cc')
-rw-r--r-- | chromeos/dbus/shill_ipconfig_client.cc | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/chromeos/dbus/shill_ipconfig_client.cc b/chromeos/dbus/shill_ipconfig_client.cc index 509696b..7381a2b7 100644 --- a/chromeos/dbus/shill_ipconfig_client.cc +++ b/chromeos/dbus/shill_ipconfig_client.cc @@ -8,6 +8,7 @@ #include "base/message_loop.h" #include "base/stl_util.h" #include "base/values.h" +#include "chromeos/dbus/shill_property_changed_observer.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -24,12 +25,19 @@ class ShillIPConfigClientImpl : public ShillIPConfigClient { public: explicit ShillIPConfigClientImpl(dbus::Bus* bus); - // ShillIPConfigClient overrides: - virtual void SetPropertyChangedHandler( + //////////////////////////////////// + // ShillIPConfigClient overrides. + virtual void AddPropertyChangedObserver( const dbus::ObjectPath& ipconfig_path, - const PropertyChangedHandler& handler) OVERRIDE; - virtual void ResetPropertyChangedHandler( - const dbus::ObjectPath& ipconfig_path) OVERRIDE; + ShillPropertyChangedObserver* observer) OVERRIDE { + GetHelper(ipconfig_path)->AddPropertyChangedObserver(observer); + } + + virtual void RemovePropertyChangedObserver( + const dbus::ObjectPath& ipconfig_path, + ShillPropertyChangedObserver* observer) OVERRIDE { + GetHelper(ipconfig_path)->RemovePropertyChangedObserver(observer); + } virtual void Refresh(const dbus::ObjectPath& ipconfig_path, const VoidDBusMethodCallback& callback) OVERRIDE; virtual void GetProperties(const dbus::ObjectPath& ipconfig_path, @@ -78,17 +86,6 @@ ShillIPConfigClientImpl::ShillIPConfigClientImpl(dbus::Bus* bus) helpers_deleter_(&helpers_) { } -void ShillIPConfigClientImpl::SetPropertyChangedHandler( - const dbus::ObjectPath& ipconfig_path, - const PropertyChangedHandler& handler) { - GetHelper(ipconfig_path)->SetPropertyChangedHandler(handler); -} - -void ShillIPConfigClientImpl::ResetPropertyChangedHandler( - const dbus::ObjectPath& ipconfig_path) { - GetHelper(ipconfig_path)->ResetPropertyChangedHandler(); -} - void ShillIPConfigClientImpl::GetProperties( const dbus::ObjectPath& ipconfig_path, const DictionaryValueCallback& callback) { @@ -190,12 +187,12 @@ class ShillIPConfigClientStubImpl : public ShillIPConfigClient { /////////////////////////////////////////////// // ShillIPConfigClient overrides: - virtual void SetPropertyChangedHandler( + virtual void AddPropertyChangedObserver( const dbus::ObjectPath& ipconfig_path, - const PropertyChangedHandler& handler) OVERRIDE {} - - virtual void ResetPropertyChangedHandler( - const dbus::ObjectPath& ipconfig_path) OVERRIDE {} + ShillPropertyChangedObserver* observer) OVERRIDE {} + virtual void RemovePropertyChangedObserver( + const dbus::ObjectPath& ipconfig_path, + ShillPropertyChangedObserver* observer) OVERRIDE {} virtual void Refresh(const dbus::ObjectPath& ipconfig_path, const VoidDBusMethodCallback& callback) OVERRIDE {} |