Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromeos / dbus / introspectable_client.h
blob1a4edab562b37ab499500db84d76e183fed86b8b
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_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client.h"
14 #include "dbus/object_path.h"
16 namespace chromeos {
18 // IntrospectableClient is used to retrieve the D-Bus introspection data
19 // from a remote object.
20 class CHROMEOS_EXPORT IntrospectableClient : public DBusClient {
21 public:
22 ~IntrospectableClient() override;
24 // The IntrospectCallback is used for the Introspect() method. It receives
25 // four arguments, the first two are the |service_name| and |object_path|
26 // of the remote object being introspected, the third is the |xml_data| of
27 // the object as described in
28 // http://dbus.freedesktop.org/doc/dbus-specification.html, the fourth
29 // |success| indicates whether the request succeeded.
30 typedef base::Callback<void(const std::string&, const dbus::ObjectPath&,
31 const std::string&, bool)> IntrospectCallback;
33 // Retrieves introspection data from the remote object on service name
34 // |service_name| with object path |object_path|, calling |callback| with
35 // the XML-formatted data received.
36 virtual void Introspect(const std::string& service_name,
37 const dbus::ObjectPath& object_path,
38 const IntrospectCallback& callback) = 0;
40 // Parses XML-formatted introspection data returned by
41 // org.freedesktop.DBus.Introspectable.Introspect and returns the list of
42 // interface names declared within.
43 static std::vector<std::string> GetInterfacesFromIntrospectResult(
44 const std::string& xml_data);
46 // Creates the instance
47 static IntrospectableClient* Create();
49 protected:
50 IntrospectableClient();
52 private:
53 DISALLOW_COPY_AND_ASSIGN(IntrospectableClient);
56 } // namespace chromeos
58 #endif // CHROMEOS_DBUS_INTROSPECTABLE_CLIENT_H_