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