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 // TODO(hidehiko): Rename this file to dbus_callback.h, when we fully
9 // get rid of DBusMethodCallStatus enum defined below.
10 
11 #include <string>
12 
13 #include "base/callback.h"
14 #include "base/component_export.h"
15 #include "base/optional.h"
16 
17 namespace dbus {
18 
19 class ObjectPath;
20 
21 }  // namespace dbus
22 
23 namespace chromeos {
24 
25 // Callback to handle response of methods with result.
26 // If the method returns multiple values, std::tuple<...> will be used.
27 // In case of error, nullopt should be passed.
28 template <typename ResultType>
29 using DBusMethodCallback =
30     base::OnceCallback<void(base::Optional<ResultType> result)>;
31 
32 // Callback to handle response of methods without result.
33 // |result| is true if the method call is successfully completed, otherwise
34 // false.
35 using VoidDBusMethodCallback = base::OnceCallback<void(bool result)>;
36 
37 // A callback to handle responses of methods returning a ObjectPath value that
38 // doesn't get call status.
39 using ObjectPathCallback =
40     base::OnceCallback<void(const dbus::ObjectPath& result)>;
41 
42 // Called when service becomes available.
43 using WaitForServiceToBeAvailableCallback =
44     base::OnceCallback<void(bool service_is_available)>;
45 
46 }  // namespace chromeos
47 
48 #endif  // CHROMEOS_DBUS_DBUS_METHOD_CALL_STATUS_H_
49