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

Unified Diff: chromeos/dbus/flimflam_client_helper.h

Issue 10170020: Rework chromeos::FlimflamDevice/ServiceClient with CallMethodWithErrorCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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
« no previous file with comments | « no previous file | chromeos/dbus/flimflam_client_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/flimflam_client_helper.h
diff --git a/chromeos/dbus/flimflam_client_helper.h b/chromeos/dbus/flimflam_client_helper.h
index dd2a261b3262707466217839030d349cf16db3fa..859d95e9c4061d9ed0ddfa3082f12767f5eb21f9 100644
--- a/chromeos/dbus/flimflam_client_helper.h
+++ b/chromeos/dbus/flimflam_client_helper.h
@@ -23,6 +23,7 @@ class DictionaryValue;
namespace dbus {
class Bus;
+class ErrorResponse;
class MessageWriter;
class MethodCall;
class ObjectPath;
@@ -54,6 +55,10 @@ class FlimflamClientHelper {
DBusMethodCallStatus call_status,
const base::DictionaryValue& result)> DictionaryValueCallback;
+ // A callback to handle erros for method call.
+ typedef base::Callback<void(const std::string& error_name,
+ const std::string& error_message)> ErrorCallback;
+
FlimflamClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy);
virtual ~FlimflamClientHelper();
@@ -79,6 +84,11 @@ class FlimflamClientHelper {
void CallDictionaryValueMethod(dbus::MethodCall* method_call,
const DictionaryValueCallback& callback);
+ // Calls a method without results with error callback.
+ void CallVoidMethodWithErrorCallback(dbus::MethodCall* method_call,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback);
+
// DEPRECATED DO NOT USE: Calls a method without results.
bool CallVoidMethodAndBlock(dbus::MethodCall* method_call);
@@ -116,6 +126,15 @@ class FlimflamClientHelper {
void OnDictionaryValueMethod(const DictionaryValueCallback& callback,
dbus::Response* response);
+ // Handles responses for methods without results.
+ // Used by CallVoidMethodWithErrorCallback().
+ void OnVoidMethodWithErrorCallback(const base::Closure& callback,
+ dbus::Response* response);
+
+ // Handles errors for method calls.
+ void OnError(const ErrorCallback& error_callback,
+ dbus::ErrorResponse* response);
+
base::WeakPtrFactory<FlimflamClientHelper> weak_ptr_factory_;
// TODO(hashimoto): Remove this when we no longer need to make blocking calls.
BlockingMethodCaller blocking_method_caller_;
« no previous file with comments | « no previous file | chromeos/dbus/flimflam_client_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698