summaryrefslogtreecommitdiffstats
path: root/dbus/message.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 07:29:21 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 07:29:21 +0000
commit3beaaa4e9b8c41be94e1688a075357b5ae58a280 (patch)
tree1c7b6d7abc4a6d54346334c132ceb5f71869661c /dbus/message.cc
parent852754acf9190bd253e8c2e9b45d2b761cf7a12a (diff)
downloadchromium_src-3beaaa4e9b8c41be94e1688a075357b5ae58a280.zip
chromium_src-3beaaa4e9b8c41be94e1688a075357b5ae58a280.tar.gz
chromium_src-3beaaa4e9b8c41be94e1688a075357b5ae58a280.tar.bz2
Add support for sending and receiving D-Bus signals.
ObjectProxy is used to receive signals from the remote object. ExportedObject is used to send signals from the exported object. Note that signals are asynchronos so we don't have a test in end_to_end_sync_unittest.cc BUG=90036 TEST=run unit tests Review URL: http://codereview.chromium.org/7655033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/message.cc')
-rw-r--r--dbus/message.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/dbus/message.cc b/dbus/message.cc
index 9216515..8de6583 100644
--- a/dbus/message.cc
+++ b/dbus/message.cc
@@ -332,6 +332,31 @@ MethodCall* MethodCall::FromRawMessage(DBusMessage* raw_message) {
}
//
+// Signal implementation.
+//
+Signal::Signal(const std::string& interface_name,
+ const std::string& method_name)
+ : Message() {
+ reset_raw_message(dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL));
+
+ SetInterface(interface_name);
+ SetMember(method_name);
+}
+
+Signal* Signal::FromRawMessage(DBusMessage* raw_message) {
+ DCHECK_EQ(DBUS_MESSAGE_TYPE_SIGNAL, dbus_message_get_type(raw_message));
+
+ const char* interface = dbus_message_get_interface(raw_message);
+ const char* member = dbus_message_get_member(raw_message);
+ std::string interface_string = interface ? interface : "";
+ std::string member_string = member ? member : "";
+
+ Signal* signal = new Signal(interface_string, member_string);
+ signal->reset_raw_message(raw_message);
+ return signal;
+}
+
+//
// Response implementation.
//