• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_
6 #define CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_
7 
8 #include <string>
9 
10 #include "base/callback.h"
11 #include "chromeos/chromeos_export.h"
12 
13 namespace dbus {
14 
15 class ObjectPath;
16 
17 }  // namespace dbus
18 
19 namespace chromeos {
20 
21 // An enum to describe whether or not a DBus method call succeeded.
22 enum DBusMethodCallStatus {
23   DBUS_METHOD_CALL_FAILURE,
24   DBUS_METHOD_CALL_SUCCESS,
25 };
26 
27 // A callback to handle responses of methods without results.
28 typedef base::Callback<void(
29     DBusMethodCallStatus call_status)> VoidDBusMethodCallback;
30 
31 // A callback to handle responses of methods returning a bool value.
32 typedef base::Callback<void(DBusMethodCallStatus call_status,
33                             bool result)> BoolDBusMethodCallback;
34 
35 // A callback to handle responses of methods returning a string value.
36 typedef base::Callback<void(
37     DBusMethodCallStatus call_status,
38     const std::string& result)> StringDBusMethodCallback;
39 
40 // A callback to handle responses of methods returning a boolean value.
41 typedef base::Callback<void(
42     DBusMethodCallStatus call_status,
43     bool result)> BooleanDBusMethodCallback;
44 
45 // A callback to handle responses of methods returning a ObjectPath value.
46 typedef base::Callback<void(
47     DBusMethodCallStatus call_status,
48     const dbus::ObjectPath& result)> ObjectPathDBusMethodCallback;
49 
50 // A callback to handle responses of methods returning a ObjectPath value that
51 // doesn't get call status.
52 typedef base::Callback<void(const dbus::ObjectPath& result)> ObjectPathCallback;
53 
54 // Returns an empty callback that does nothing.
55 CHROMEOS_EXPORT VoidDBusMethodCallback EmptyVoidDBusMethodCallback();
56 
57 }  // namespace chromeos
58 
59 #endif  // CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_
60