Darin Petkov | 18fb2f7 | 2012-06-14 09:09:34 +0200 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 SHILL_DBUS_SERVICE_PROXY_H_ |
| 6 | #define SHILL_DBUS_SERVICE_PROXY_H_ |
| 7 | |
| 8 | #include "shill/dbus_bindings/dbus-service.h" |
| 9 | #include "shill/dbus_service_proxy_interface.h" |
| 10 | |
| 11 | namespace shill { |
| 12 | |
| 13 | class DBusServiceProxy : public DBusServiceProxyInterface { |
| 14 | public: |
| 15 | explicit DBusServiceProxy(DBus::Connection *connection); |
| 16 | virtual ~DBusServiceProxy(); |
| 17 | |
| 18 | // Inherited from DBusServiceProxyInterface. |
| 19 | virtual void GetNameOwner(const std::string &name, |
| 20 | Error *error, |
| 21 | const StringCallback &callback, |
| 22 | int timeout); |
| 23 | virtual void set_name_owner_changed_callback( |
| 24 | const NameOwnerChangedCallback &callback); |
| 25 | |
| 26 | private: |
| 27 | class Proxy : public org::freedesktop::DBus_proxy, |
| 28 | public DBus::ObjectProxy { |
| 29 | public: |
| 30 | Proxy(DBus::Connection *connection); |
| 31 | virtual ~Proxy(); |
| 32 | |
| 33 | void set_name_owner_changed_callback( |
| 34 | const NameOwnerChangedCallback &callback); |
| 35 | |
| 36 | private: |
| 37 | // Signal callbacks inherited from DBus_proxy. |
| 38 | virtual void NameOwnerChanged(const std::string &name, |
| 39 | const std::string &old_owner, |
| 40 | const std::string &new_owner); |
| 41 | |
| 42 | // Method callbacks inherited from Device_proxy. |
| 43 | virtual void GetNameOwnerCallback(const std::string &unique_name, |
| 44 | const DBus::Error &error, void *data); |
| 45 | |
| 46 | NameOwnerChangedCallback name_owner_changed_callback_; |
| 47 | |
| 48 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 49 | }; |
| 50 | |
| 51 | static void FromDBusError(const DBus::Error &dbus_error, Error *error); |
| 52 | |
| 53 | Proxy proxy_; |
| 54 | |
| 55 | DISALLOW_COPY_AND_ASSIGN(DBusServiceProxy); |
| 56 | }; |
| 57 | |
| 58 | } // namespace shill |
| 59 | |
| 60 | #endif // SHILL_DBUS_SERVICE_PROXY_H_ |