summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/dbus_method_call_status.h
blob: 7c189e2055c64af2857722d6f11832a3630e707e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_
#define CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_

#include <string>

#include "base/callback.h"
#include "chromeos/chromeos_export.h"

namespace dbus {

class ObjectPath;

}  // namespace dbus

namespace chromeos {

// An enum to describe whether or not a DBus method call succeeded.
enum DBusMethodCallStatus {
  DBUS_METHOD_CALL_FAILURE,
  DBUS_METHOD_CALL_SUCCESS,
};

// A callback to handle responses of methods without results.
typedef base::Callback<void(
    DBusMethodCallStatus call_status)> VoidDBusMethodCallback;

// A callback to handle responses of methods returning a bool value.
typedef base::Callback<void(DBusMethodCallStatus call_status,
                            bool result)> BoolDBusMethodCallback;

// A callback to handle responses of methods returning a string value.
typedef base::Callback<void(
    DBusMethodCallStatus call_status,
    const std::string& result)> StringDBusMethodCallback;

// A callback to handle responses of methods returning a boolean value.
typedef base::Callback<void(
    DBusMethodCallStatus call_status,
    bool result)> BooleanDBusMethodCallback;

// A callback to handle responses of methods returning a ObjectPath value.
typedef base::Callback<void(
    DBusMethodCallStatus call_status,
    const dbus::ObjectPath& result)> ObjectPathDBusMethodCallback;

// A callback to handle responses of methods returning a ObjectPath value that
// doesn't get call status.
typedef base::Callback<void(const dbus::ObjectPath& result)> ObjectPathCallback;

// Returns an empty callback that does nothing.
CHROMEOS_EXPORT VoidDBusMethodCallback EmptyVoidDBusMethodCallback();

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_