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.
5 #ifndef CHROMEOS_DBUS_INTROSPECTABLE_CLIENT_H_
6 #define CHROMEOS_DBUS_INTROSPECTABLE_CLIENT_H_
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client_implementation_type.h"
14 #include "dbus/object_path.h"
22 // IntrospectableClient is used to retrieve the D-Bus introspection data
23 // from a remote object.
24 class CHROMEOS_EXPORT IntrospectableClient
{
26 virtual ~IntrospectableClient();
28 // The IntrospectCallback is used for the Introspect() method. It receives
29 // four arguments, the first two are the |service_name| and |object_path|
30 // of the remote object being introspected, the third is the |xml_data| of
31 // the object as described in
32 // http://dbus.freedesktop.org/doc/dbus-specification.html, the fourth
33 // |success| indicates whether the request succeeded.
34 typedef base::Callback
<void(const std::string
&, const dbus::ObjectPath
&,
35 const std::string
&, bool)> IntrospectCallback
;
37 // Retrieves introspection data from the remote object on service name
38 // |service_name| with object path |object_path|, calling |callback| with
39 // the XML-formatted data received.
40 virtual void Introspect(const std::string
& service_name
,
41 const dbus::ObjectPath
& object_path
,
42 const IntrospectCallback
& callback
) = 0;
44 // Parses XML-formatted introspection data returned by
45 // org.freedesktop.DBus.Introspectable.Introspect and returns the list of
46 // interface names declared within.
47 static std::vector
<std::string
> GetInterfacesFromIntrospectResult(
48 const std::string
& xml_data
);
50 // Creates the instance
51 static IntrospectableClient
* Create(DBusClientImplementationType type
,
55 IntrospectableClient();
58 DISALLOW_COPY_AND_ASSIGN(IntrospectableClient
);
61 } // namespace chromeos
63 #endif // CHROMEOS_DBUS_INTROSPECTABLE_CLIENT_H_