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

Unified Diff: chromeos/dbus/shill_client_helper.h

Issue 10949030: This converts the Shill clients to allow propagation of shill errors (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/shill_client_helper.h
diff --git a/chromeos/dbus/shill_client_helper.h b/chromeos/dbus/shill_client_helper.h
index 84534e090c8acafb4e3babdb4ef4e882cf0818e2..106afad1796b5996029ae6025ce7dc8ee014af7b 100644
--- a/chromeos/dbus/shill_client_helper.h
+++ b/chromeos/dbus/shill_client_helper.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "chromeos/dbus/blocking_method_caller.h"
#include "chromeos/dbus/dbus_method_call_status.h"
@@ -47,24 +48,27 @@ class ShillClientHelper {
DBusMethodCallStatus call_status,
const base::DictionaryValue& result)> DictionaryValueCallback;
- // A callback to handle responses for methods with DictionaryValue reuslts.
+ // A callback to handle responses for methods with DictionaryValue results.
// This is used by CallDictionaryValueMethodWithErrorCallback.
typedef base::Callback<void(const base::DictionaryValue& result
)> DictionaryValueCallbackWithoutStatus;
- // A callback to handle erros for method call.
+ // A callback to handle errors for method call.
typedef base::Callback<void(const std::string& error_name,
const std::string& error_message)> ErrorCallback;
+ class PropertyChangedObserver {
hashimoto 2012/09/21 11:52:01 Please add class comment, especially about the eve
Greg Spencer (Chromium) 2012/09/21 22:03:47 Done.
+ public:
+ virtual void OnPropertyChanged(const std::string& name,
+ const base::Value& value) = 0;
+ };
+
ShillClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy);
virtual ~ShillClientHelper();
- // Sets PropertyChanged signal handler.
- void SetPropertyChangedHandler(const PropertyChangedHandler& handler);
-
- // Resets PropertyChanged signal handler.
- void ResetPropertyChangedHandler();
+ void AddPropertyChangedObserver(PropertyChangedObserver* observer);
hashimoto 2012/09/21 11:52:01 Please add method comments.
Greg Spencer (Chromium) 2012/09/21 22:03:47 Done.
+ void RemovePropertyChangedObserver(PropertyChangedObserver* observer);
// Starts monitoring PropertyChanged signal.
void MonitorPropertyChanged(const std::string& interface_name);
@@ -77,6 +81,12 @@ class ShillClientHelper {
void CallObjectPathMethod(dbus::MethodCall* method_call,
const ObjectPathDBusMethodCallback& callback);
+ // Calls a method with an object path result where there is an error callback.
+ void CallObjectPathMethodWithErrorCallback(
+ dbus::MethodCall* method_call,
+ const ObjectPathDBusMethodCallback& callback,
hashimoto 2012/09/21 11:52:01 Can we introduce something like DictionaryValueCal
Greg Spencer (Chromium) 2012/09/21 22:03:47 Done.
+ const ErrorCallback& error_callback);
+
// Calls a method with a dictionary value result.
void CallDictionaryValueMethod(dbus::MethodCall* method_call,
const DictionaryValueCallback& callback);
@@ -150,6 +160,7 @@ class ShillClientHelper {
BlockingMethodCaller blocking_method_caller_;
dbus::ObjectProxy* proxy_;
PropertyChangedHandler property_changed_handler_;
+ ObserverList<PropertyChangedObserver> observer_list_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.

Powered by Google App Engine
This is Rietveld 408576698